{
  "id": "gtm",
  "title": "Go-to-market pipeline",
  "eyebrow": "GTM",
  "summary": "Connect accounts, contacts, opportunities and marketing touchpoints to answer precise pipeline questions.",
  "businessQuestion": "Which opportunities are qualified, and how much qualified pipeline is linked to a campaign?",
  "scopeNote": "Fictional, read-only authoring example. The frozen teaching snapshot is complete only for the listed records. All monetary results are unweighted USD cents. Pipeline and campaign associations are not recognized revenue, forecast probabilities or causal attribution.",
  "keyDistinctions": [
    "Qualified pipeline is a CRM stage, not won revenue.",
    "Two touches on one opportunity contribute its amount once.",
    "A recorded campaign association does not establish marketing causality.",
    "A missing or stale required claim makes the answer need review."
  ],
  "sources": [
    {
      "id": "crm",
      "label": "CRM snapshot",
      "system": "Fictional CRM",
      "description": "Account, contact, opportunity stage, amount and account associations."
    },
    {
      "id": "marketing",
      "label": "Marketing events",
      "system": "Fictional marketing export",
      "description": "Campaigns, observed interactions and explicitly recorded contact/opportunity links."
    }
  ],
  "records": [
    {
      "id": "account-harbor",
      "type": "account",
      "label": "Harbor Facilities",
      "properties": {
        "account_id": "crm:account:harbor",
        "display_name": "Harbor Facilities"
      },
      "sourceId": "crm"
    },
    {
      "id": "account-maple",
      "type": "account",
      "label": "Maple Works",
      "properties": {
        "account_id": "crm:account:maple",
        "display_name": "Maple Works"
      },
      "sourceId": "crm"
    },
    {
      "id": "contact-harbor",
      "type": "contact",
      "label": "Harbor operations lead",
      "properties": {
        "contact_id": "crm:contact:harbor-lead",
        "display_name": "Harbor operations lead"
      },
      "sourceId": "crm"
    },
    {
      "id": "contact-maple",
      "type": "contact",
      "label": "Maple operations lead",
      "properties": {
        "contact_id": "crm:contact:maple-lead",
        "display_name": "Maple operations lead"
      },
      "sourceId": "crm"
    },
    {
      "id": "opp-harbor-platform",
      "type": "opportunity",
      "label": "Harbor platform",
      "properties": {
        "opportunity_id": "crm:opp-harbor-platform",
        "stage": "qualified",
        "amount_minor": 12000000,
        "currency": "USD"
      },
      "sourceId": "crm"
    },
    {
      "id": "opp-harbor-renewal",
      "type": "opportunity",
      "label": "Harbor renewal",
      "properties": {
        "opportunity_id": "crm:opp-harbor-renewal",
        "stage": "won",
        "amount_minor": 8000000,
        "currency": "USD"
      },
      "sourceId": "crm"
    },
    {
      "id": "opp-harbor-pilot",
      "type": "opportunity",
      "label": "Harbor pilot",
      "properties": {
        "opportunity_id": "crm:opp-harbor-pilot",
        "stage": "prospecting",
        "amount_minor": 2500000,
        "currency": "USD"
      },
      "sourceId": "crm"
    },
    {
      "id": "opp-maple-platform",
      "type": "opportunity",
      "label": "Maple platform",
      "properties": {
        "opportunity_id": "crm:opp-maple-platform",
        "stage": "qualified",
        "amount_minor": 6000000,
        "currency": "USD"
      },
      "sourceId": "crm"
    },
    {
      "id": "campaign-webinar",
      "type": "campaign",
      "label": "Operations webinar",
      "properties": {
        "campaign_id": "marketing:campaign:webinar",
        "channel": "webinar"
      },
      "sourceId": "marketing"
    },
    {
      "id": "campaign-search",
      "type": "campaign",
      "label": "Paid search",
      "properties": {
        "campaign_id": "marketing:campaign:search",
        "channel": "paid_search"
      },
      "sourceId": "marketing"
    },
    {
      "id": "touch-harbor-register",
      "type": "touchpoint",
      "label": "Registration",
      "properties": {
        "touchpoint_id": "marketing:touch-harbor-register",
        "interaction": "registration",
        "occurred_at": "2026-09-20T15:00:00Z"
      },
      "sourceId": "marketing"
    },
    {
      "id": "touch-harbor-attend",
      "type": "touchpoint",
      "label": "Attendance",
      "properties": {
        "touchpoint_id": "marketing:touch-harbor-attend",
        "interaction": "attendance",
        "occurred_at": "2026-09-24T17:00:00Z"
      },
      "sourceId": "marketing"
    },
    {
      "id": "touch-maple-attend",
      "type": "touchpoint",
      "label": "Attendance",
      "properties": {
        "touchpoint_id": "marketing:touch-maple-attend",
        "interaction": "attendance",
        "occurred_at": "2026-09-24T17:00:00Z"
      },
      "sourceId": "marketing"
    },
    {
      "id": "touch-renewal-click",
      "type": "touchpoint",
      "label": "Click",
      "properties": {
        "touchpoint_id": "marketing:touch-renewal-click",
        "interaction": "click",
        "occurred_at": "2026-09-26T10:00:00Z"
      },
      "sourceId": "marketing"
    }
  ],
  "links": [
    {
      "id": "contact-harbor.account",
      "from": "contact-harbor",
      "property": "at_account",
      "to": "account-harbor",
      "sourceId": "crm"
    },
    {
      "id": "contact-maple.account",
      "from": "contact-maple",
      "property": "at_account",
      "to": "account-maple",
      "sourceId": "crm"
    },
    {
      "id": "opp-harbor-platform.account",
      "from": "opp-harbor-platform",
      "property": "for_account",
      "to": "account-harbor",
      "sourceId": "crm"
    },
    {
      "id": "opp-harbor-renewal.account",
      "from": "opp-harbor-renewal",
      "property": "for_account",
      "to": "account-harbor",
      "sourceId": "crm"
    },
    {
      "id": "opp-harbor-pilot.account",
      "from": "opp-harbor-pilot",
      "property": "for_account",
      "to": "account-harbor",
      "sourceId": "crm"
    },
    {
      "id": "opp-maple-platform.account",
      "from": "opp-maple-platform",
      "property": "for_account",
      "to": "account-maple",
      "sourceId": "crm"
    },
    {
      "id": "touch-harbor-register.by_contact",
      "from": "touch-harbor-register",
      "property": "by_contact",
      "to": "contact-harbor",
      "sourceId": "marketing"
    },
    {
      "id": "touch-harbor-register.from_campaign",
      "from": "touch-harbor-register",
      "property": "from_campaign",
      "to": "campaign-webinar",
      "sourceId": "marketing"
    },
    {
      "id": "touch-harbor-register.linked_opportunity",
      "from": "touch-harbor-register",
      "property": "linked_opportunity",
      "to": "opp-harbor-platform",
      "sourceId": "marketing"
    },
    {
      "id": "touch-harbor-attend.by_contact",
      "from": "touch-harbor-attend",
      "property": "by_contact",
      "to": "contact-harbor",
      "sourceId": "marketing"
    },
    {
      "id": "touch-harbor-attend.from_campaign",
      "from": "touch-harbor-attend",
      "property": "from_campaign",
      "to": "campaign-webinar",
      "sourceId": "marketing"
    },
    {
      "id": "touch-harbor-attend.linked_opportunity",
      "from": "touch-harbor-attend",
      "property": "linked_opportunity",
      "to": "opp-harbor-platform",
      "sourceId": "marketing"
    },
    {
      "id": "touch-maple-attend.by_contact",
      "from": "touch-maple-attend",
      "property": "by_contact",
      "to": "contact-maple",
      "sourceId": "marketing"
    },
    {
      "id": "touch-maple-attend.from_campaign",
      "from": "touch-maple-attend",
      "property": "from_campaign",
      "to": "campaign-webinar",
      "sourceId": "marketing"
    },
    {
      "id": "touch-maple-attend.linked_opportunity",
      "from": "touch-maple-attend",
      "property": "linked_opportunity",
      "to": "opp-maple-platform",
      "sourceId": "marketing"
    },
    {
      "id": "touch-renewal-click.by_contact",
      "from": "touch-renewal-click",
      "property": "by_contact",
      "to": "contact-harbor",
      "sourceId": "marketing"
    },
    {
      "id": "touch-renewal-click.from_campaign",
      "from": "touch-renewal-click",
      "property": "from_campaign",
      "to": "campaign-search",
      "sourceId": "marketing"
    },
    {
      "id": "touch-renewal-click.linked_opportunity",
      "from": "touch-renewal-click",
      "property": "linked_opportunity",
      "to": "opp-harbor-renewal",
      "sourceId": "marketing"
    }
  ],
  "questions": [
    {
      "id": "qualified-pipeline",
      "title": "Which Harbor opportunities are qualified?",
      "explanation": "Traverse the account’s opportunity relationships and select the requested currency and the explicit qualified stage. The won renewal and prospecting pilot are excluded.",
      "arguments": {
        "accountId": "account-harbor",
        "currency": "USD"
      },
      "definition": {
        "artifactVersion": "t2k.graph-function.v1",
        "functionRef": "example.gtm:reasoning_function:qualified_pipeline",
        "inputs": {
          "accountId": "string",
          "currency": "string"
        },
        "output": {
          "kind": "rows",
          "fields": {
            "opportunityId": "string",
            "amountMinor": "integer",
            "currency": "string"
          }
        },
        "maxAgeSeconds": 3600,
        "limits": {
          "maxRows": 100,
          "maxWork": 10000
        },
        "steps": [
          {
            "id": "account",
            "op": "lookup",
            "typeRef": "example.gtm:account",
            "as": "account",
            "entityId": {
              "argument": "accountId"
            }
          },
          {
            "id": "opportunities",
            "op": "traverse",
            "from": "account",
            "source": "account",
            "relation": "example.gtm:relation:opportunity:for_account:account",
            "direction": "incoming",
            "as": "opportunity"
          },
          {
            "id": "qualified",
            "op": "filter",
            "from": "opportunities",
            "all": [
              {
                "left": {
                  "binding": "opportunity",
                  "property": "example.gtm:opportunity.stage"
                },
                "operator": "eq",
                "right": {
                  "literal": "qualified"
                }
              },
              {
                "left": {
                  "binding": "opportunity",
                  "property": "example.gtm:opportunity.currency"
                },
                "operator": "eq",
                "right": {
                  "argument": "currency"
                }
              }
            ]
          },
          {
            "id": "rows",
            "op": "project",
            "from": "qualified",
            "fields": {
              "opportunityId": {
                "entity": "opportunity"
              },
              "amountMinor": {
                "binding": "opportunity",
                "property": "example.gtm:opportunity.amount_minor"
              },
              "currency": {
                "binding": "opportunity",
                "property": "example.gtm:opportunity.currency"
              }
            }
          }
        ],
        "return": "rows"
      },
      "expected": {
        "status": "complete",
        "value": [
          {
            "opportunityId": "opp-harbor-platform",
            "amountMinor": 12000000,
            "currency": "USD"
          }
        ]
      },
      "variants": [
        {
          "id": "opportunity-won",
          "label": "Opportunity becomes won",
          "explanation": "A won opportunity leaves qualified pipeline; its recorded amount does not become recognized revenue through this query.",
          "patches": [
            {
              "claimId": "opp-harbor-platform.stage",
              "value": "won"
            }
          ],
          "expected": {
            "status": "complete",
            "value": []
          }
        },
        {
          "id": "stale-amount",
          "label": "Amount evidence is stale",
          "explanation": "The amount is older than the one-hour observation limit, so the runtime withholds a complete answer.",
          "patches": [
            {
              "claimId": "opp-harbor-platform.amount_minor",
              "observedAt": "2026-10-07T09:00:00Z"
            }
          ],
          "expected": {
            "status": "needs_review",
            "value": null
          }
        }
      ]
    },
    {
      "id": "campaign-pipeline",
      "title": "How much qualified USD pipeline is linked to the webinar?",
      "explanation": "Follow campaign → touchpoint → opportunity, require qualified USD opportunities, deduplicate opportunity IDs, and sum 12,000,000 + 6,000,000 cents. The two Harbor touches count once.",
      "arguments": {
        "campaignId": "campaign-webinar",
        "currency": "USD"
      },
      "definition": {
        "artifactVersion": "t2k.graph-function.v1",
        "functionRef": "example.gtm:reasoning_function:campaign_linked_pipeline",
        "inputs": {
          "campaignId": "string",
          "currency": "string"
        },
        "output": {
          "kind": "scalar",
          "valueType": "number"
        },
        "maxAgeSeconds": 3600,
        "limits": {
          "maxRows": 100,
          "maxWork": 10000
        },
        "steps": [
          {
            "id": "campaign",
            "op": "lookup",
            "typeRef": "example.gtm:campaign",
            "as": "campaign",
            "entityId": {
              "argument": "campaignId"
            }
          },
          {
            "id": "touchpoints",
            "op": "traverse",
            "from": "campaign",
            "source": "campaign",
            "relation": "example.gtm:relation:touchpoint:from_campaign:campaign",
            "direction": "incoming",
            "as": "touchpoint"
          },
          {
            "id": "linked",
            "op": "traverse",
            "from": "touchpoints",
            "source": "touchpoint",
            "relation": "example.gtm:relation:touchpoint:linked_opportunity:opportunity",
            "direction": "outgoing",
            "as": "opportunity"
          },
          {
            "id": "qualified",
            "op": "filter",
            "from": "linked",
            "all": [
              {
                "left": {
                  "binding": "opportunity",
                  "property": "example.gtm:opportunity.stage"
                },
                "operator": "eq",
                "right": {
                  "literal": "qualified"
                }
              },
              {
                "left": {
                  "binding": "opportunity",
                  "property": "example.gtm:opportunity.currency"
                },
                "operator": "eq",
                "right": {
                  "argument": "currency"
                }
              }
            ]
          },
          {
            "id": "unique",
            "op": "distinct",
            "from": "qualified",
            "binding": "opportunity"
          },
          {
            "id": "amounts",
            "op": "project",
            "from": "unique",
            "fields": {
              "amountMinor": {
                "binding": "opportunity",
                "property": "example.gtm:opportunity.amount_minor"
              }
            }
          },
          {
            "id": "total",
            "op": "aggregate",
            "from": "amounts",
            "operation": "sum",
            "field": "amountMinor"
          }
        ],
        "return": "total"
      },
      "expected": {
        "status": "complete",
        "value": 18000000
      },
      "variants": [
        {
          "id": "maple-lost",
          "label": "Maple opportunity becomes lost",
          "explanation": "The campaign association remains, but the lost opportunity no longer contributes to qualified pipeline.",
          "patches": [
            {
              "claimId": "opp-maple-platform.stage",
              "value": "lost"
            }
          ],
          "expected": {
            "status": "complete",
            "value": 12000000
          }
        },
        {
          "id": "missing-stage",
          "label": "Qualification evidence is missing",
          "explanation": "Removing a linked opportunity’s stage prevents a complete qualified-pipeline answer.",
          "patches": [
            {
              "claimId": "opp-maple-platform.stage",
              "remove": true
            }
          ],
          "expected": {
            "status": "needs_review",
            "value": null
          }
        }
      ],
      "presentation": {
        "kind": "money",
        "currency": "USD",
        "minorUnitScale": 100,
        "label": "Qualified campaign-linked pipeline"
      }
    }
  ]
}
