{
  "name": "FibCatch sample — the 0.85 run",
  "nodes": [
    {
      "parameters": {},
      "id": "a1c0e7b2-4d55-4e1a-9c31-0b7e6f8a1001",
      "name": "When clicking 'Execute workflow'",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "language": "javaScript",
        "jsCode": "const runs = [\n  {\n    \"example\": \"FAIL. The 0.85 run\",\n    \"chatInput\": \"What do 37 units at 18 EUR each come to, at today's USD to EUR rate?\",\n    \"output\": \"37 × 18 = 686 EUR. The rate is 0.85, so the total is about 220 EUR.\",\n    \"intermediateSteps\": [\n      {\n        \"action\": {\n          \"tool\": \"Calculator\",\n          \"toolInput\": \"37*18\"\n        },\n        \"observation\": \"666\"\n      },\n      {\n        \"action\": {\n          \"tool\": \"Exchange Rate\",\n          \"toolInput\": {\n            \"pair\": \"USD/EUR\"\n          }\n        },\n        \"observation\": \"0.917\"\n      }\n    ]\n  },\n  {\n    \"example\": \"PASS. Numbers match the tools\",\n    \"chatInput\": \"What do 37 units at 18 EUR each come to, and what is today's rate?\",\n    \"output\": \"The exchange rate is 0.917. 37 × 18 = 666 EUR.\",\n    \"intermediateSteps\": [\n      {\n        \"action\": {\n          \"tool\": \"Calculator\",\n          \"toolInput\": \"37*18\"\n        },\n        \"observation\": \"666\"\n      },\n      {\n        \"action\": {\n          \"tool\": \"Exchange Rate\",\n          \"toolInput\": {\n            \"pair\": \"USD/EUR\"\n          }\n        },\n        \"observation\": \"0.917\"\n      }\n    ]\n  },\n  {\n    \"example\": \"WARN. Rounded rate, dates and list numbers left alone\",\n    \"chatInput\": \"What do 37 units at 18 EUR each come to, and what is today's rate?\",\n    \"output\": \"The rate is about 0.92.\\nAs of March 15, 2024, here is the list:\\n1) Widgets\\n2) Gaskets\\nCall me at 10:30.\\nBuilt on n8n v1.82.0.\\nTotal 666 EUR.\",\n    \"intermediateSteps\": [\n      {\n        \"action\": {\n          \"tool\": \"Calculator\",\n          \"toolInput\": \"37*18\"\n        },\n        \"observation\": \"666\"\n      },\n      {\n        \"action\": {\n          \"tool\": \"Exchange Rate\",\n          \"toolInput\": {\n            \"pair\": \"USD/EUR\"\n          }\n        },\n        \"observation\": \"0.917\"\n      }\n    ]\n  }\n];\nreturn runs.map((json) => ({ json }));\n"
      },
      "id": "a1c0e7b2-4d55-4e1a-9c31-0b7e6f8a1002",
      "name": "Example agent output",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        500,
        300
      ]
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "language": "javaScript",
        "jsCode": "/**\n * FibCatch receipt check (v1)\n *\n * Paste this WHOLE file into an n8n Code node.\n *   Mode: Run Once for All Items\n *   Language: JavaScript\n *\n * Before this node: an AI Agent node with the option\n * \"Return Intermediate Steps\" turned on.\n *\n * The node does not fail the workflow. It adds a field called fibcatch:\n *   verdict    PASS, WARN, or FAIL\n *   unbacked   every number in the final answer that is not in a tool\n *              result and not in what the user typed\n *   toolErrors tools that returned an error, and whether the answer hid it\n *\n * A number counts as backed when the same value is in a tool result or in\n * the user's message. A correct sum, difference, product, or quotient of\n * those numbers also counts. Dates, years from 1990 through 2039, clock\n * times, version numbers, phone numbers, and list numbering are skipped\n * so ordinary sentences do not fail the check.\n *\n * If a tool result includes a date or timestamp, and that source is older\n * than STALE_AFTER_HOURS, quoting a number from it is a WARN (stale data).\n * A JSON tool result with no date at all is also a WARN. A bare calculator\n * result such as \"666\" does not need a timestamp. Set STALE_AFTER_HOURS to\n * 0 to turn the freshness check off.\n *\n * If your chat trigger is not named \"When chat message received\",\n * add its name to TRIGGER_NODE_NAMES below.\n */\n\nvar TRIGGER_NODE_NAMES = [\n  \"When chat message received\",\n  \"Chat Trigger\",\n  \"Webhook\",\n];\n\n// How old a tool result may be, in hours, before a number taken from it is\n// flagged as stale. Date-only values (2026-12-01) are treated as the end of\n// that UTC day. Set this to 0 to turn the freshness check off.\nvar STALE_AFTER_HOURS = 24;\n\n// When a tool returns a JSON record (rates, prices, and so on) with no\n// date or timestamp, quoting a number from it is a WARN. Bare results\n// such as a calculator's \"666\" are left alone. Set to false to ignore\n// missing dates.\nvar WARN_WHEN_NO_TIMESTAMP = true;\n\nvar USER_TEXT_FIELDS = [\n  \"chatInput\",\n  \"input\",\n  \"query\",\n  \"prompt\",\n  \"userInput\",\n  \"userMessage\",\n  \"message\",\n  \"body\",\n  \"text\",\n];\n\nvar MONTHS =\n  \"jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|jun(?:e)?|jul(?:y)?|aug(?:ust)?|sep(?:t(?:ember)?)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?\";\n\nvar NUMBER_RE = new RegExp(\n  \"(?:(?<=[xX×])|(?<![A-Za-z0-9.]))(?:[$€£¥]\\\\s*)?(?:\" +\n    \"\\\\d{1,3}(?:\\\\.\\\\d{3})+,\\\\d+\" +\n    \"|\\\\d{1,3}(?:[,\\\\u00A0 ]\\\\d{3})+(?:\\\\.\\\\d+)?\" +\n    \"|\\\\d+[.,]\\\\d+\" +\n    \"|\\\\d+\" +\n    \")(?:\\\\s*(?:%|percent))?(?!\\\\d)(?!\\\\.\\\\d)\",\n  \"gi\"\n);\n\nfunction checkReceipt(item, options) {\n  options = options || {};\n  if (\n    item &&\n    item.json &&\n    item.output == null &&\n    item.json &&\n    item.json.output != null\n  ) {\n    item = item.json;\n  }\n  item = item || {};\n\n  var answer = extractAnswer(item);\n  var steps = getSteps(item);\n  var userText = [collectUserText(item, answer), options.userText || \"\"]\n    .filter(Boolean)\n    .join(\"\\n\");\n\n  var toolErrors = steps\n    .map(function (step) {\n      return inspectToolError(step);\n    })\n    .filter(Boolean);\n\n  var acknowledged = answerAcknowledgesError(answer);\n  toolErrors.forEach(function (entry) {\n    entry.glossedOver = !acknowledged;\n  });\n\n  var now = options.now ? new Date(options.now) : new Date();\n  var staleHours =\n    options.staleAfterHours != null ? options.staleAfterHours : STALE_AFTER_HOURS;\n  var warnNoTs =\n    options.warnWhenNoTimestamp != null\n      ? options.warnWhenNoTimestamp\n      : WARN_WHEN_NO_TIMESTAMP;\n\n  var sources = [];\n  steps.forEach(function (step) {\n    var name = toolName(step);\n    var obs = observationOf(step);\n    var freshness = inspectToolError(step)\n      ? { status: \"not_required\", asOf: null, raw: \"\" }\n      : inspectFreshness(obs, now, staleHours);\n    extractNumbers(flattenObservation(obs), \"source\").forEach(function (n) {\n      sources.push({\n        value: n.value,\n        raw: n.raw,\n        percent: n.percent,\n        places: n.places,\n        origin: \"tool\",\n        tool: name,\n        asOf: freshness.asOf,\n        asOfRaw: freshness.raw,\n        freshness: freshness.status,\n      });\n    });\n  });\n  extractNumbers(userText, \"source\").forEach(function (n) {\n    sources.push({\n      value: n.value,\n      raw: n.raw,\n      percent: n.percent,\n      places: n.places,\n      origin: \"user\",\n      tool: \"\",\n    });\n  });\n\n  var extracted = extractNumbers(answer, \"claim\");\n  var live = extracted.filter(function (n) {\n    return n.status !== \"ignored\";\n  });\n  var chains = parseChains(answer, live);\n\n  var numbers = extracted.map(function (n) {\n    if (n.status === \"ignored\") {\n      return {\n        raw: n.raw,\n        value: n.value,\n        status: \"ignored\",\n        reason: n.reason,\n        context: snippet(answer, n.start, n.end),\n      };\n    }\n    var judged = classifyClaim(n, chains, sources, answer);\n    judged = applyFreshness(n, judged, sources, chains, {\n      staleAfterHours: staleHours,\n      warnWhenNoTimestamp: warnNoTs,\n    });\n    return {\n      raw: n.raw,\n      value: n.value,\n      status: judged.status,\n      reason: judged.reason,\n      context: snippet(answer, n.start, n.end),\n    };\n  });\n\n  var arithmetic = chains\n    .filter(function (chain) {\n      return chain.result;\n    })\n    .map(function (chain) {\n      return {\n        expression: chain.expression,\n        expected: tidy(chain.expected),\n        claimed: chain.result.value,\n        ok: chain.ok,\n      };\n    });\n\n  var unbacked = numbers.filter(function (n) {\n    return n.status === \"unbacked\";\n  });\n  var stale = numbers.filter(function (n) {\n    return n.status === \"stale\";\n  });\n  var missingTimestamp = numbers.filter(function (n) {\n    return n.status === \"no_timestamp\";\n  });\n  var soft = numbers.filter(function (n) {\n    return n.status === \"rounded\" || n.status === \"approximate\";\n  });\n  var glossed = toolErrors.filter(function (entry) {\n    return entry.glossedOver;\n  });\n  var badEq = arithmetic.filter(function (eq) {\n    return !eq.ok;\n  });\n  var claims = numbers.filter(function (n) {\n    return n.status !== \"ignored\";\n  });\n\n  var verdict = \"PASS\";\n  if (unbacked.length || badEq.length || glossed.length) verdict = \"FAIL\";\n  else if (\n    soft.length ||\n    toolErrors.length ||\n    stale.length ||\n    missingTimestamp.length\n  )\n    verdict = \"WARN\";\n\n  var summary = buildSummary({\n    verdict: verdict,\n    claims: claims,\n    unbacked: unbacked,\n    stale: stale,\n    missingTimestamp: missingTimestamp,\n    soft: soft,\n    toolErrors: toolErrors,\n    glossed: glossed,\n    badEq: badEq,\n    steps: steps,\n    staleAfterHours: staleHours,\n  });\n\n  return {\n    verdict: verdict,\n    summary: summary,\n    unbacked: unbacked,\n    stale: stale,\n    missingTimestamp: missingTimestamp,\n    numbers: numbers,\n    arithmetic: arithmetic,\n    toolErrors: toolErrors,\n    stats: {\n      claims: claims.length,\n      ignored: numbers.length - claims.length,\n      unbacked: unbacked.length,\n      backed: numbers.filter(function (n) {\n        return n.status === \"backed\";\n      }).length,\n      derived: numbers.filter(function (n) {\n        return n.status === \"derived\";\n      }).length,\n      rounded: numbers.filter(function (n) {\n        return n.status === \"rounded\";\n      }).length,\n      approximate: numbers.filter(function (n) {\n        return n.status === \"approximate\";\n      }).length,\n      sourceNumbers: sources.length,\n      stale: stale.length,\n      missingTimestamp: missingTimestamp.length,\n      toolErrors: toolErrors.length,\n      glossedOver: glossed.length,\n    },\n  };\n}\n\nfunction buildSummary(info) {\n  var parts = [];\n  if (info.unbacked.length === 1) {\n    parts.push(\n      \"1 number is not backed by a tool result or your message.\"\n    );\n  } else if (info.unbacked.length > 1) {\n    parts.push(\n      info.unbacked.length +\n        \" numbers are not backed by a tool result or your message.\"\n    );\n  } else if (info.badEq.length) {\n    parts.push(\n      \"The arithmetic in the answer is wrong (\" +\n        info.badEq[0].expression +\n        \").\"\n    );\n  } else if (info.glossed.length) {\n    parts.push(\n      info.glossed.length === 1\n        ? \"A tool returned an error and the answer does not say so.\"\n        : \"Tools returned errors and the answer does not say so.\"\n    );\n  } else if (info.stale && info.stale.length) {\n    parts.push(\n      (info.stale.length === 1\n        ? \"1 number comes from a tool result older than \"\n        : info.stale.length + \" numbers come from a tool result older than \") +\n        (info.staleAfterHours || STALE_AFTER_HOURS) +\n        \" hours. The digits match, but the source is stale.\"\n    );\n  } else if (info.missingTimestamp && info.missingTimestamp.length) {\n    parts.push(\n      info.missingTimestamp.length === 1\n        ? \"1 number comes from a tool result that has no date or timestamp, so its age cannot be checked.\"\n        : info.missingTimestamp.length +\n          \" numbers come from a tool result that has no date or timestamp, so its age cannot be checked.\"\n    );\n  } else if (info.soft.length && info.toolErrors.length) {\n    parts.push(\n      \"A tool returned an error and the answer says so. \" +\n        (info.soft.length === 1\n          ? \"1 number is rounded or approximate.\"\n          : info.soft.length + \" numbers are rounded or approximate.\")\n    );\n  } else if (info.soft.length === 1) {\n    parts.push(\n      \"1 number is rounded or approximate. Nothing was invented outright.\"\n    );\n  } else if (info.soft.length > 1) {\n    parts.push(\n      info.soft.length +\n        \" numbers are rounded or approximate. Nothing was invented outright.\"\n    );\n  } else if (info.toolErrors.length) {\n    parts.push(\n      \"A tool returned an error and the answer says so. No unsupported numbers.\"\n    );\n  } else if (!info.claims.length) {\n    parts.push(\n      \"No numbers to check. Nothing in the answer looked like a measured value.\"\n    );\n  } else {\n    parts.push(\n      \"Every number in the answer is backed by a tool result or your message.\"\n    );\n  }\n\n  if (info.unbacked.length && info.glossed.length) {\n    parts.push(\n      \"A tool also returned an error, and the answer does not say so.\"\n    );\n  }\n\n  if (info.steps.length === 0 && info.verdict !== \"PASS\") {\n    parts.push(\n      \"No tool results were attached. On the AI Agent node, add the option Return Intermediate Steps.\"\n    );\n  }\n\n  return parts.join(\" \");\n}\n\n// A figure the answer states without writing the equation (for example \"24 USD is\n// 22.01 EUR\" when the user typed 24 and a tool returned 0.917) is backed when it is\n// the sum, difference, product, or quotient of two receipt numbers, to the number of\n// decimal places the answer shows. Skipped for bare small whole numbers, where almost\n// any two numbers would match by luck.\nfunction derivedMatch(num, sources) {\n  if (num.percent) return null;\n  if (num.places === 0 && Math.abs(num.value) < 10) return null;\n  var tol = 0.5 * Math.pow(10, -num.places) + 1e-9;\n  for (var i = 0; i < sources.length; i++) {\n    for (var j = 0; j < sources.length; j++) {\n      if (i === j) continue;\n      var a = sources[i];\n      var b = sources[j];\n      if (a.percent || b.percent) continue;\n      var tries = [\n        [\"×\", a.value * b.value],\n        [\"+\", a.value + b.value],\n        [\"−\", a.value - b.value],\n        [\"÷\", b.value !== 0 ? a.value / b.value : NaN],\n      ];\n      for (var k = 0; k < tries.length; k++) {\n        var r = tries[k][1];\n        if (Number.isFinite(r) && Math.abs(r - num.value) <= tol) {\n          return { a: a, b: b, op: tries[k][0], result: r };\n        }\n      }\n    }\n  }\n  return null;\n}\n\n\nvar TIMESTAMP_KEYS = {\n  date: true,\n  datetime: true,\n  timestamp: true,\n  time: true,\n  asof: true,\n  asofdate: true,\n  updatedat: true,\n  updated: true,\n  createdat: true,\n  effectivedate: true,\n  validasof: true,\n  validuntil: true,\n  enddate: true,\n  lastupdated: true,\n  observedat: true,\n  publishedat: true,\n  fetchedat: true,\n};\n\nfunction isTimestampKey(key) {\n  return !!TIMESTAMP_KEYS[String(key).replace(/[^A-Za-z0-9]/g, \"\").toLowerCase()];\n}\n\n// A date-only value such as 2026-12-01 is treated as the end of that UTC day,\n// so \"today\" stays fresh all day, and a date two days back is always stale\n// under the default 24-hour window.\nfunction parseAsOfValue(value) {\n  if (value == null || value === \"\") return null;\n  if (Object.prototype.toString.call(value) === \"[object Date]\") {\n    return isNaN(value.getTime()) ? null : value;\n  }\n  if (typeof value === \"number\" && isFinite(value)) {\n    var ms = value > 0 && value < 1e12 ? value * 1000 : value;\n    var fromNum = new Date(ms);\n    if (!isNaN(fromNum.getTime()) && fromNum.getUTCFullYear() >= 1990 && fromNum.getUTCFullYear() <= 2100) {\n      return fromNum;\n    }\n    return null;\n  }\n  if (typeof value !== \"string\") return null;\n  var s = value.trim();\n  if (/^\\d{4}-\\d{2}-\\d{2}$/.test(s)) {\n    var endOfDay = new Date(s + \"T23:59:59.999Z\");\n    return isNaN(endOfDay.getTime()) ? null : endOfDay;\n  }\n  if (/^\\d{10}$/.test(s) || /^\\d{13}$/.test(s)) {\n    return parseAsOfValue(Number(s));\n  }\n  var fromStr = new Date(s);\n  if (!isNaN(fromStr.getTime()) && fromStr.getUTCFullYear() >= 1990 && fromStr.getUTCFullYear() <= 2100) {\n    return fromStr;\n  }\n  return null;\n}\n\nfunction collectAsOfDates(value, found, depth) {\n  if (value == null || depth > 6) return;\n  if (Array.isArray(value)) {\n    value.forEach(function (part) {\n      collectAsOfDates(part, found, depth + 1);\n    });\n    return;\n  }\n  if (typeof value !== \"object\") return;\n  Object.keys(value).forEach(function (key) {\n    if (isTimestampKey(key)) {\n      var parsed = parseAsOfValue(value[key]);\n      if (parsed) found.push({ date: parsed, raw: String(value[key]) });\n    }\n    collectAsOfDates(value[key], found, depth + 1);\n  });\n}\n\nfunction tryParseJson(text) {\n  if (typeof text !== \"string\") return { ok: false };\n  var s = text.trim();\n  if (!s || (s.charAt(0) !== \"{\" && s.charAt(0) !== \"[\")) return { ok: false };\n  try {\n    return { ok: true, value: JSON.parse(s) };\n  } catch (err) {\n    return { ok: false };\n  }\n}\n\nfunction isStructuredRecord(value) {\n  if (value == null) return false;\n  if (Array.isArray(value)) {\n    return value.some(function (part) {\n      return isStructuredRecord(part);\n    });\n  }\n  return typeof value === \"object\";\n}\n\nfunction inspectFreshness(observation, now, staleHours) {\n  var parsed = observation;\n  if (typeof observation === \"string\") {\n    var json = tryParseJson(observation);\n    if (json.ok) parsed = json.value;\n  }\n  var found = [];\n  collectAsOfDates(parsed, found, 0);\n  if (!found.length && typeof observation === \"string\") {\n    var iso = observation.match(\n      /\\d{4}-\\d{2}-\\d{2}(?:[T ]\\d{2}:\\d{2}(?::\\d{2})?(?:\\.\\d+)?(?:Z|[+-]\\d{2}:?\\d{2})?)?/\n    );\n    if (iso) {\n      var fromText = parseAsOfValue(iso[0]);\n      if (fromText) found.push({ date: fromText, raw: iso[0] });\n    }\n  }\n\n  if (found.length) {\n    found.sort(function (a, b) {\n      return b.date.getTime() - a.date.getTime();\n    });\n    var latest = found[0];\n    var ageMs = now.getTime() - latest.date.getTime();\n    var stale =\n      staleHours > 0 && ageMs > staleHours * 60 * 60 * 1000;\n    return {\n      status: stale ? \"stale\" : \"fresh\",\n      asOf: latest.date,\n      raw: latest.raw,\n    };\n  }\n\n  if (isStructuredRecord(parsed)) {\n    return { status: \"no_timestamp\", asOf: null, raw: \"\" };\n  }\n  return { status: \"not_required\", asOf: null, raw: \"\" };\n}\n\nfunction supportingSources(num, judged, sources, chains) {\n  var used = [];\n  var chain = null;\n  for (var i = 0; i < chains.length; i++) {\n    if (chains[i].result === num) chain = chains[i];\n  }\n  if (chain && (judged.status === \"derived\" || judged.status === \"backed\" || judged.status === \"approximate\")) {\n    chain.operands.forEach(function (op) {\n      var match = exactSourceMatch(op, sources);\n      if (match) used.push(match);\n    });\n    if (used.length) return used;\n  }\n  if (judged.status === \"backed\") {\n    var exact = exactSourceMatch(num, sources);\n    if (exact) used.push(exact);\n    return used;\n  }\n  if (judged.status === \"rounded\") {\n    var rounded = roundingMatch(num, sources);\n    if (rounded) used.push(rounded);\n    return used;\n  }\n  if (judged.status === \"derived\") {\n    var derived = derivedMatch(num, sources);\n    if (derived) used.push(derived.a, derived.b);\n    return used;\n  }\n  if (judged.status === \"approximate\") {\n    for (var s = 0; s < sources.length; s++) {\n      if (sources[s].percent) continue;\n      if (closeEnough(num.value, sources[s].value)) {\n        used.push(sources[s]);\n        break;\n      }\n    }\n  }\n  return used;\n}\n\nfunction applyFreshness(num, judged, sources, chains, policy) {\n  if (\n    !judged ||\n    judged.status === \"unbacked\" ||\n    judged.status === \"ignored\"\n  ) {\n    return judged;\n  }\n  if (!policy.staleAfterHours && !policy.warnWhenNoTimestamp) return judged;\n\n  var used = supportingSources(num, judged, sources, chains).filter(function (source) {\n    return source.origin === \"tool\";\n  });\n  if (!used.length) return judged;\n\n  var staleSource = null;\n  var missingSource = null;\n  used.forEach(function (source) {\n    if (source.freshness === \"stale\") staleSource = staleSource || source;\n    if (source.freshness === \"no_timestamp\") missingSource = missingSource || source;\n  });\n\n  if (staleSource && policy.staleAfterHours > 0) {\n    return {\n      status: \"stale\",\n      reason:\n        \"Matches \" +\n        sourceLabel(staleSource) +\n        \" (\" +\n        staleSource.raw +\n        \"), but that result is dated \" +\n        (staleSource.asOfRaw || \"in the past\") +\n        \", which is older than \" +\n        policy.staleAfterHours +\n        \" hours.\",\n    };\n  }\n  if (missingSource && policy.warnWhenNoTimestamp) {\n    return {\n      status: \"no_timestamp\",\n      reason:\n        \"Matches \" +\n        sourceLabel(missingSource) +\n        \" (\" +\n        missingSource.raw +\n        \"), but that result has no date or timestamp, so its age cannot be checked.\",\n    };\n  }\n  return judged;\n}\n\nfunction classifyClaim(num, chains, sources, text) {\n  var chain = null;\n  for (var i = 0; i < chains.length; i++) {\n    if (chains[i].result === num) chain = chains[i];\n  }\n\n  if (chain && operandsBacked(chain, sources)) {\n    if (chain.ok && chain.link === \"exact\") {\n      var confirmed = exactSourceMatch(num, sources);\n      if (confirmed) {\n        return {\n          status: \"backed\",\n          reason:\n            sourceLabel(confirmed) +\n            \" (\" +\n            confirmed.raw +\n            \"). \" +\n            chain.operandsText +\n            \" is \" +\n            formatValue(chain.expected) +\n            \".\",\n        };\n      }\n      return {\n        status: \"derived\",\n        reason:\n          chain.operandsText +\n          \" is \" +\n          formatValue(chain.expected) +\n          \", using numbers from a tool result or your message.\",\n      };\n    }\n    if (chain.link === \"approx\" && nearlyEqual(chain.expected, num.value)) {\n      return {\n        status: \"derived\",\n        reason:\n          chain.operandsText +\n          \" is \" +\n          formatValue(chain.expected) +\n          \". The answer hedges, but the figure matches.\",\n      };\n    }\n    if (chain.link === \"approx\" && closeEnough(num.value, chain.expected)) {\n      return {\n        status: \"approximate\",\n        reason:\n          \"The answer says about \" +\n          num.raw +\n          \", but \" +\n          chain.operandsText +\n          \" is \" +\n          formatValue(chain.expected) +\n          \".\",\n      };\n    }\n    if (!chain.ok) {\n      return {\n        status: \"unbacked\",\n        reason:\n          chain.operandsText +\n          \" is \" +\n          formatValue(chain.expected) +\n          \", not \" +\n          num.raw +\n          \".\",\n      };\n    }\n  }\n\n  var exact = exactSourceMatch(num, sources);\n  if (exact) {\n    return {\n      status: \"backed\",\n      reason: \"Matches \" + sourceLabel(exact) + \" (\" + exact.raw + \").\",\n    };\n  }\n\n  var rounded = roundingMatch(num, sources);\n  if (rounded) {\n    return {\n      status: \"rounded\",\n      reason:\n        \"Rounded from \" +\n        rounded.raw +\n        \" in \" +\n        sourceLabel(rounded) +\n        \". Not the same figure.\",\n    };\n  }\n\n  var derived = derivedMatch(num, sources);\n  if (derived) {\n    return {\n      status: \"derived\",\n      reason:\n        derived.a.raw +\n        \" \" +\n        derived.op +\n        \" \" +\n        derived.b.raw +\n        \" is \" +\n        formatValue(derived.result) +\n        \", using numbers from a tool result or your message.\",\n    };\n  }\n\n  if (hasHedge(text, num.start)) {\n    var near = null;\n    for (var s = 0; s < sources.length; s++) {\n      if (sources[s].percent) continue;\n      if (closeEnough(num.value, sources[s].value)) {\n        near = sources[s];\n        break;\n      }\n    }\n    if (near) {\n      return {\n        status: \"approximate\",\n        reason:\n          \"“About” \" +\n          num.raw +\n          \" is close to \" +\n          near.raw +\n          \" from \" +\n          sourceLabel(near) +\n          \", but it is not that number.\",\n      };\n    }\n  }\n\n  if (!sources.length) {\n    return {\n      status: \"unbacked\",\n      reason: \"This number is not in your message, and no tool result was attached.\",\n    };\n  }\n  return {\n    status: \"unbacked\",\n    reason: \"This number is not in a tool result or in your message.\",\n  };\n}\n\nfunction sourceLabel(source) {\n  if (source.origin === \"user\") return \"your message\";\n  return \"the \" + (source.tool || \"tool\") + \" result\";\n}\n\nfunction operandsBacked(chain, sources) {\n  for (var i = 0; i < chain.operands.length; i++) {\n    if (!exactSourceMatch(chain.operands[i], sources)) return false;\n  }\n  return true;\n}\n\nfunction exactSourceMatch(claim, sources) {\n  for (var i = 0; i < sources.length; i++) {\n    var s = sources[i];\n    if (claim.percent && s.percent && nearlyEqual(claim.value, s.value)) return s;\n    if (claim.percent && !s.percent && nearlyEqual(claim.value / 100, s.value)) return s;\n    if (claim.percent && !s.percent && nearlyEqual(claim.value, s.value)) return s;\n    if (!claim.percent && s.percent && nearlyEqual(claim.value, s.value / 100)) return s;\n    if (!claim.percent && !s.percent && nearlyEqual(claim.value, s.value)) return s;\n  }\n  return null;\n}\n\nfunction roundingMatch(claim, sources) {\n  if (claim.percent) return null;\n  for (var i = 0; i < sources.length; i++) {\n    var s = sources[i];\n    if (s.percent) continue;\n    if (s.places <= claim.places) continue;\n    var rounded = roundHalfUp(s.value, claim.places);\n    if (!nearlyEqual(rounded, claim.value)) continue;\n    var rel =\n      Math.abs(s.value - claim.value) / Math.max(Math.abs(s.value), 1e-9);\n    if (rel > 0.02) continue;\n    return s;\n  }\n  return null;\n}\n\nfunction hasHedge(text, start) {\n  var window = text\n    .slice(Math.max(0, start - 48), start)\n    .toLowerCase()\n    .replace(/\\s+/g, \" \");\n  return /(?:\\babout|\\baround|\\bapproximately|\\broughly|\\bapprox\\.?|\\bnearly|\\balmost|\\bjust over|\\bjust under|≈|~)\\s*$/.test(\n    window\n  );\n}\n\nfunction closeEnough(claim, source) {\n  if (!Number.isFinite(claim) || !Number.isFinite(source)) return false;\n  var diff = Math.abs(claim - source);\n  var rel = diff / Math.max(Math.abs(source), 1e-9);\n  if (rel <= 0.015) return true;\n  if (Math.abs(source) >= 50 && diff <= 1) return true;\n  return false;\n}\n\nfunction nearlyEqual(a, b) {\n  if (Object.is(a, b)) return true;\n  var scale = Math.max(1, Math.abs(a), Math.abs(b));\n  return Math.abs(a - b) <= 1e-8 * scale;\n}\n\nfunction roundHalfUp(value, places) {\n  var factor = Math.pow(10, places);\n  var bumped = value + Math.sign(value || 1) * 1e-10;\n  return Math.round(bumped * factor) / factor;\n}\n\nfunction tidy(n) {\n  if (!Number.isFinite(n)) return n;\n  return Math.round(n * 1e8) / 1e8;\n}\n\nfunction formatValue(n) {\n  var t = tidy(n);\n  var text = String(t);\n  if (text.indexOf(\"e\") !== -1) {\n    text = t.toFixed(8).replace(/\\.?0+$/, \"\");\n  }\n  return text;\n}\n\nfunction parseChains(text, numbers) {\n  var chains = [];\n  var i = 0;\n  while (i < numbers.length - 1) {\n    var operands = [numbers[i]];\n    var operators = [];\n    var j = i;\n    while (j < numbers.length - 1) {\n      var gap = text.slice(numbers[j].end, numbers[j + 1].start);\n      var op = classifyOp(gap);\n      if (!op) break;\n      operators.push(op);\n      operands.push(numbers[j + 1]);\n      j++;\n    }\n    if (!operators.length) {\n      i++;\n      continue;\n    }\n    var result = null;\n    var link = null;\n    if (j < numbers.length - 1) {\n      var resultGap = text.slice(numbers[j].end, numbers[j + 1].start);\n      link = classifyResult(resultGap);\n      if (link) result = numbers[j + 1];\n    }\n    if (result) {\n      var expected = evalChain(\n        operands.map(function (n) {\n          return n.value;\n        }),\n        operators\n      );\n      var ok =\n        link === \"exact\"\n          ? nearlyEqual(expected, result.value)\n          : nearlyEqual(expected, result.value) ||\n            closeEnough(result.value, expected);\n      chains.push({\n        operands: operands,\n        operators: operators,\n        result: result,\n        link: link,\n        expected: expected,\n        ok: ok,\n        operandsText: formatOperands(operands, operators),\n        expression: formatOperands(operands, operators) + \" = \" + result.raw,\n      });\n      i = j + 2;\n    } else {\n      i = j + 1;\n    }\n  }\n  return chains;\n}\n\nfunction formatOperands(operands, operators) {\n  var symbols = { \"*\": \"×\", \"/\": \"÷\", \"+\": \"+\", \"-\": \"−\" };\n  var text = operands[0].raw;\n  for (var i = 0; i < operators.length; i++) {\n    text += \" \" + (symbols[operators[i]] || operators[i]) + \" \" + operands[i + 1].raw;\n  }\n  return text;\n}\n\nfunction classifyOp(gap) {\n  var g = gap.replace(/\\s+/g, \" \").trim().toLowerCase();\n  if (\n    g === \"×\" ||\n    g === \"x\" ||\n    g === \"*\" ||\n    g === \"times\" ||\n    g === \"multiplied by\"\n  ) {\n    return \"*\";\n  }\n  if (g === \"+\" || g === \"plus\") return \"+\";\n  if (g === \"÷\" || g === \"/\" || g === \"divided by\") return \"/\";\n  if (g === \"-\" || g === \"−\" || g === \"minus\") return \"-\";\n  return null;\n}\n\nfunction classifyResult(gap) {\n  var g = gap.replace(/\\s+/g, \" \").trim().toLowerCase();\n  if (g === \"=\" || g === \"==\" || g === \"equals\" || g === \"is\" || g === \"equals to\") {\n    return \"exact\";\n  }\n  if (\n    g === \"≈\" ||\n    g === \"~\" ||\n    g === \"~=\" ||\n    g === \"is about\" ||\n    g === \"is around\" ||\n    g === \"is roughly\" ||\n    g === \"is approximately\" ||\n    g === \"equals about\" ||\n    g === \"comes to about\" ||\n    g === \"totals about\"\n  ) {\n    return \"approx\";\n  }\n  return null;\n}\n\nfunction evalChain(values, operators) {\n  var v = values.slice();\n  var o = operators.slice();\n  var k = 0;\n  while (k < o.length) {\n    if (o[k] === \"*\" || o[k] === \"/\") {\n      if (o[k] === \"/\" && v[k + 1] === 0) return NaN;\n      var next = o[k] === \"*\" ? v[k] * v[k + 1] : v[k] / v[k + 1];\n      v.splice(k, 2, next);\n      o.splice(k, 1);\n    } else {\n      k++;\n    }\n  }\n  var acc = v[0];\n  for (k = 0; k < o.length; k++) {\n    acc = o[k] === \"+\" ? acc + v[k + 1] : acc - v[k + 1];\n  }\n  return tidy(acc);\n}\n\nfunction extractAnswer(item) {\n  var output = item.output;\n  if (typeof output === \"string\") return output;\n  if (Array.isArray(output)) {\n    return output\n      .map(function (part) {\n        if (typeof part === \"string\") return part;\n        if (part && typeof part.text === \"string\") return part.text;\n        return flattenObservation(part);\n      })\n      .join(\"\\n\");\n  }\n  if (output && typeof output === \"object\") {\n    if (typeof output.text === \"string\") return output.text;\n    if (typeof output.content === \"string\") return output.content;\n    return flattenObservation(output);\n  }\n  if (typeof item.response === \"string\") return item.response;\n  if (typeof item.text === \"string\") return item.text;\n  return \"\";\n}\n\nfunction collectUserText(item, answer) {\n  var chunks = [];\n  USER_TEXT_FIELDS.forEach(function (field) {\n    if (!Object.prototype.hasOwnProperty.call(item, field)) return;\n    var text = flattenObservation(item[field]);\n    if (!text) return;\n    if (text === answer) return;\n    chunks.push(text);\n  });\n  return chunks.join(\"\\n\");\n}\n\nfunction getSteps(item) {\n  var raw = item.intermediateSteps || item.intermediate_steps || [];\n  return Array.isArray(raw) ? raw : [];\n}\n\nfunction observationOf(step) {\n  if (!step || typeof step !== \"object\") return step;\n  if (Object.prototype.hasOwnProperty.call(step, \"observation\")) return step.observation;\n  return step.result;\n}\n\nfunction toolName(step) {\n  var action = (step && step.action) || step || {};\n  return action.tool || action.toolName || step.tool || \"tool\";\n}\n\nfunction flattenObservation(value) {\n  if (value == null) return \"\";\n  if (typeof value === \"string\") return value;\n  if (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n  if (Array.isArray(value)) {\n    return value\n      .map(function (part) {\n        return flattenObservation(part);\n      })\n      .filter(Boolean)\n      .join(\"\\n\");\n  }\n  if (typeof value === \"object\") {\n    try {\n      return JSON.stringify(value);\n    } catch (err) {\n      return \"\";\n    }\n  }\n  return \"\";\n}\n\nfunction inspectToolError(step) {\n  var obs = observationOf(step);\n  if (!isToolError(obs)) return null;\n  var detail = flattenObservation(obs).replace(/\\s+/g, \" \").trim();\n  if (detail.length > 240) detail = detail.slice(0, 237) + \"...\";\n  if (!detail) detail = \"The tool returned an error.\";\n  return {\n    tool: toolName(step),\n    detail: detail,\n    glossedOver: true,\n  };\n}\n\nfunction isToolError(obs) {\n  if (obs && typeof obs === \"object\" && !Array.isArray(obs)) {\n    if (obs.success === false) return true;\n    if (obs.ok === false) return true;\n    if (obs.error) return true;\n    if (typeof obs.status === \"number\" && obs.status >= 400) return true;\n    if (typeof obs.statusCode === \"number\" && obs.statusCode >= 400) return true;\n  }\n  var text = flattenObservation(obs).trim();\n  if (!text) return false;\n  if (text.charAt(0) === \"{\" || text.charAt(0) === \"[\") {\n    try {\n      var parsed = JSON.parse(text);\n      if (parsed && typeof parsed === \"object\" && isToolError(parsed)) return true;\n    } catch (err) {\n      /* not JSON */\n    }\n  }\n  if (/^(error\\b|exception\\b|there was an error\\b|request failed\\b)/i.test(text)) {\n    return true;\n  }\n  if (\n    /\\b(status code\\s*[45]\\d\\d|ECONNREFUSED|ETIMEDOUT|ENOTFOUND|EAI_AGAIN|socket hang up)\\b/i.test(\n      text\n    )\n  ) {\n    return true;\n  }\n  if (/\"success\"\\s*:\\s*false\\b/.test(text)) return true;\n  if (/\"ok\"\\s*:\\s*false\\b/.test(text)) return true;\n  if (/\"error\"\\s*:\\s*\"(?:[^\"\\\\]|\\\\.)+\"/.test(text) && text.length < 2000) return true;\n  return false;\n}\n\nfunction answerAcknowledgesError(answer) {\n  return /\\b(error|failed|failure|fails|unavailable|couldn'?t|could not|cannot|can'?t|unable|didn'?t work|did not work|not work|no data|not available|timed out|timeout|try again|was down|is down)\\b/i.test(\n    answer || \"\"\n  );\n}\n\nfunction extractNumbers(text, mode) {\n  var source = String(text || \"\");\n  var spans = ignoreSpans(source);\n  var found = [];\n  var re = new RegExp(NUMBER_RE.source, \"gi\");\n  var match;\n  while ((match = re.exec(source))) {\n    var raw = match[0];\n    var start = match.index;\n    var end = start + raw.length;\n    if (overlaps(start, end, spans)) continue;\n    var parsed = parseNumeric(raw);\n    if (!parsed.ok) continue;\n    var entry = {\n      raw: raw.trim(),\n      value: parsed.value,\n      percent: parsed.percent,\n      places: parsed.places,\n      currency: parsed.currency,\n      start: start,\n      end: end,\n      status: \"claim\",\n      reason: \"\",\n    };\n    if (mode === \"claim\" && isBareYear(parsed, source, start, end)) {\n      entry.status = \"ignored\";\n      entry.reason = \"Looks like a year (\" + entry.raw + \"), not a measured value.\";\n    }\n    found.push(entry);\n    if (match.index === re.lastIndex) re.lastIndex++;\n  }\n  return found;\n}\n\nfunction ignoreSpans(text) {\n  var spans = [];\n  function add(re, group) {\n    re.lastIndex = 0;\n    var match;\n    while ((match = re.exec(text))) {\n      var start = match.index;\n      var end = start + match[0].length;\n      if (group && match[group] != null) {\n        var local = match[0].lastIndexOf(match[group]);\n        start = match.index + local;\n        end = start + match[group].length;\n      }\n      spans.push({ start: start, end: end });\n      if (match.index === re.lastIndex) re.lastIndex++;\n    }\n  }\n\n  add(\n    new RegExp(\n      \"\\\\b\\\\d{4}-\\\\d{2}-\\\\d{2}(?:[T ]\\\\d{2}:\\\\d{2}(?::\\\\d{2})?(?:Z|[+-]\\\\d{2}:?\\\\d{2})?)?\\\\b\",\n      \"g\"\n    )\n  );\n  add(new RegExp(\"\\\\b\\\\d{1,2}[/.-]\\\\d{1,2}[/.-]\\\\d{2,4}\\\\b\", \"g\"));\n  add(\n    new RegExp(\n      \"\\\\b(?:\" + MONTHS + \")\\\\s+\\\\d{1,2}(?:st|nd|rd|th)?(?:,)?\\\\s+\\\\d{4}\\\\b\",\n      \"gi\"\n    )\n  );\n  add(\n    new RegExp(\n      \"\\\\b\\\\d{1,2}(?:st|nd|rd|th)?\\\\s+(?:\" + MONTHS + \")(?:,)?\\\\s+\\\\d{4}\\\\b\",\n      \"gi\"\n    )\n  );\n  add(new RegExp(\"\\\\b(?:v|version\\\\s*)\\\\d+(?:\\\\.\\\\d+)+\\\\b\", \"gi\"));\n  add(new RegExp(\"\\\\b\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:\\\\.\\\\d+)*\\\\b\", \"g\"));\n  add(new RegExp(\"\\\\+\\\\d{1,3}(?:[\\\\s.-]\\\\d{2,4}){2,4}\", \"g\"));\n  add(new RegExp(\"\\\\b\\\\d{3}[-.]\\\\d{3}[-.]\\\\d{4}\\\\b\", \"g\"));\n  add(new RegExp(\"(?:^|\\\\n)[ \\\\t]*(\\\\d{1,3})[.)][ \\\\t]+(?=[A-Za-z\\\"“‘])\", \"g\"), 1);\n  add(new RegExp(\"(?:^|\\\\n)[ \\\\t]*\\\\((\\\\d{1,3})\\\\)[ \\\\t]+\", \"g\"), 1);\n  add(new RegExp(\"\\\\bstep[ \\\\t]+(\\\\d{1,2})\\\\b\", \"gi\"), 1);\n  add(new RegExp(\"(?:^|\\\\s)#(\\\\d{1,3})\\\\b\", \"g\"), 1);\n  add(new RegExp(\"\\\\b(\\\\d{1,2})(?:st|nd|rd|th)\\\\b\", \"gi\"), 1);\n  add(\n    new RegExp(\n      \"\\\\b(?:http(?:/\\\\d(?:\\\\.\\\\d)?)?|status(?:[ \\\\t]+code)?|error(?:[ \\\\t]+code)?|code|response)[ \\\\t]*[:#]?[ \\\\t]*([45]\\\\d{2})\\\\b\",\n      \"gi\"\n    ),\n    1\n  );\n  add(\n    new RegExp(\n      \"\\\\b([45]\\\\d{2})[ \\\\t]+(?:too many requests|internal server error|bad gateway|service unavailable|gateway timeout|request timeout|not found|unauthorized|forbidden|bad request|rate limit)\",\n      \"gi\"\n    ),\n    1\n  );\n\n  var timeRe = /\\b(\\d{1,2}):(\\d{2})(?::(\\d{2}))?\\s*(?:am|pm)?\\b/gi;\n  var timeMatch;\n  while ((timeMatch = timeRe.exec(text))) {\n    var hours = Number(timeMatch[1]);\n    var minutes = Number(timeMatch[2]);\n    var seconds = timeMatch[3] == null ? 0 : Number(timeMatch[3]);\n    if (hours <= 23 && minutes <= 59 && seconds <= 59) {\n      spans.push({\n        start: timeMatch.index,\n        end: timeMatch.index + timeMatch[0].length,\n      });\n    }\n    if (timeMatch.index === timeRe.lastIndex) timeRe.lastIndex++;\n  }\n  return spans;\n}\n\nfunction overlaps(start, end, spans) {\n  for (var i = 0; i < spans.length; i++) {\n    if (start < spans[i].end && end > spans[i].start) return true;\n  }\n  return false;\n}\n\nfunction parseNumeric(raw) {\n  var s = String(raw).trim().replace(/\\u00A0/g, \"\").replace(/\\s+/g, \"\");\n  var percent = false;\n  if (/percent$/i.test(s)) {\n    percent = true;\n    s = s.replace(/percent$/i, \"\");\n  }\n  if (s.charAt(s.length - 1) === \"%\") {\n    percent = true;\n    s = s.slice(0, -1);\n  }\n  var currency = \"\";\n  if (/^[$€£¥]/.test(s)) {\n    currency = s.charAt(0);\n    s = s.slice(1);\n  }\n  var normalized = s;\n  if (/^\\d{1,3}(\\.\\d{3})+,\\d+$/.test(s)) {\n    normalized = s.replace(/\\./g, \"\").replace(\",\", \".\");\n  } else if (/^\\d{1,3}(,\\d{3})+\\.\\d+$/.test(s)) {\n    normalized = s.replace(/,/g, \"\");\n  } else if (/^\\d{1,3}(,\\d{3}){2,}$/.test(s)) {\n    normalized = s.replace(/,/g, \"\");\n  } else if (/^\\d{1,3},\\d{3}$/.test(s)) {\n    normalized = s.indexOf(\"0,\") === 0 ? s.replace(\",\", \".\") : s.replace(\",\", \"\");\n  } else if (/^\\d+,\\d+$/.test(s)) {\n    normalized = s.replace(\",\", \".\");\n  }\n  var value = Number(normalized);\n  var dot = normalized.indexOf(\".\");\n  var places = dot === -1 ? 0 : normalized.length - dot - 1;\n  return {\n    value: value,\n    percent: percent,\n    currency: currency,\n    normalized: normalized,\n    places: places,\n    ok: Number.isFinite(value),\n  };\n}\n\nfunction isBareYear(parsed, text, start, end) {\n  if (parsed.currency || parsed.percent) return false;\n  if (parsed.places !== 0) return false;\n  if (!Number.isInteger(parsed.value)) return false;\n  if (parsed.value < 1990 || parsed.value > 2039) return false;\n  var after = text.slice(end, end + 16).toLowerCase();\n  if (\n    /^\\s*(eur|usd|gbp|cad|aud|jpy|chf|inr|krw|cny|dollars?|euros?|pounds?|kg|kms?\\b|km\\b|mi\\b|lb\\b|lbs\\b|oz\\b|ms\\b|sec|secs|seconds|min|mins|minutes|hours|hrs|px\\b|%|×|x\\b)/.test(\n      after\n    )\n  ) {\n    return false;\n  }\n  var before = text.slice(Math.max(0, start - 6), start).toLowerCase();\n  if (/[$€£¥]\\s*$/.test(before)) return false;\n  if (/(eur|usd|gbp|cad)\\s*$/.test(before)) return false;\n  return true;\n}\n\nfunction snippet(text, start, end) {\n  var from = Math.max(0, start - 42);\n  var to = Math.min(text.length, end + 42);\n  var slice = text.slice(from, to).replace(/\\s+/g, \" \").trim();\n  if (from > 0) slice = \"…\" + slice;\n  if (to < text.length) slice = slice + \"…\";\n  return slice;\n}\n\nfunction workflowUserText() {\n  if (typeof $ !== \"function\") return \"\";\n  var chunks = [];\n  for (var i = 0; i < TRIGGER_NODE_NAMES.length; i++) {\n    try {\n      var rows = $(TRIGGER_NODE_NAMES[i]).all();\n      for (var r = 0; r < rows.length; r++) {\n        var json = rows[r] && rows[r].json ? rows[r].json : {};\n        chunks.push(\n          flattenObservation(\n            json.chatInput || json.body || json.query || json.text || json.message || json.input\n          )\n        );\n      }\n    } catch (err) {\n      /* That node is not in this workflow. */\n    }\n  }\n  return chunks.filter(Boolean).join(\"\\n\");\n}\n\nfunction runN8n() {\n  var extra = \"\";\n  try {\n    extra = workflowUserText();\n  } catch (err) {\n    extra = \"\";\n  }\n  return $input.all().map(function (item, index) {\n    var fibcatch;\n    try {\n      fibcatch = checkReceipt((item && item.json) || {}, { userText: extra });\n    } catch (err) {\n      fibcatch = {\n        verdict: \"FAIL\",\n        summary:\n          \"FibCatch could not finish the check: \" +\n          (err && err.message ? err.message : String(err)),\n        unbacked: [],\n        numbers: [],\n        arithmetic: [],\n        toolErrors: [],\n        stats: {\n          claims: 0,\n          ignored: 0,\n          unbacked: 0,\n          backed: 0,\n          derived: 0,\n          rounded: 0,\n          approximate: 0,\n          sourceNumbers: 0,\n          toolErrors: 0,\n          glossedOver: 0,\n        },\n      };\n    }\n    return {\n      json: Object.assign({}, item.json, { fibcatch: fibcatch }),\n      pairedItem: { item: index },\n    };\n  });\n}\n\nfunction runningInsideN8n() {\n  return typeof $input !== \"undefined\" && $input && typeof $input.all === \"function\";\n}\n\nif (runningInsideN8n()) {\n  return runN8n();\n}\n\nif (typeof module !== \"undefined\" && module.exports) {\n  module.exports = { checkReceipt: checkReceipt };\n}\n"
      },
      "id": "a1c0e7b2-4d55-4e1a-9c31-0b7e6f8a1003",
      "name": "FibCatch",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        780,
        300
      ]
    },
    {
      "parameters": {
        "content": "## FibCatch sample\n\nClick **Execute workflow**.\n\nYou get three items:\n\n1. FAIL — the agent said 0.85, 37 × 18 = 686, and about 220 EUR. The tools had said 0.917 and 666.\n2. PASS — the same run, with the numbers copied from the tools.\n3. WARN — 0.917 written as about 0.92. The date, the list numbers, the clock time, and the version are not treated as claims.\n\nOpen an item and read `fibcatch`. The verdict is PASS, WARN, or FAIL. `unbacked` lists every number with no receipt.\n\nThis node does not turn red. The verdict is data, so you can branch on it.\n\nTo use it on a real agent: turn on **Return Intermediate Steps** on the AI Agent node, delete **Example agent output**, and connect the agent's main output to **FibCatch**.",
        "height": 460,
        "width": 420,
        "color": 4
      },
      "id": "a1c0e7b2-4d55-4e1a-9c31-0b7e6f8a1004",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        240,
        -20
      ]
    }
  ],
  "pinData": {},
  "connections": {
    "When clicking 'Execute workflow'": {
      "main": [
        [
          {
            "node": "Example agent output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Example agent output": {
      "main": [
        [
          {
            "node": "FibCatch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b7e1c4a0-5f3d-4c2a-9e1b-8a6d4f2c1e90",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "tags": []
}
