{
  "version": 1,
  "task": "linkedin_marketo_integration",
  "portable": true,
  "contract": "maestro.linkedin-marketo-integration.v1",
  "prompts": {
    "build": {
      "title": "Integration record builder",
      "text": "LINKEDIN–MARKETO INTEGRATION RECORD BUILDER — portable v1\n\nCreate or repair one `maestro.linkedin-marketo-integration.v1` JSON record using only the facts attached by the user. Do not assume access to this webpage, private accounts, external files, or earlier conversation. When a fact is missing, leave its value as the empty string and list the exact evidence needed next. Never invent account state, IDs, timestamps, permission, receipts, outcomes or owner opinions. Never include secrets or personal lead data.\n\nKeep these states distinct:\n- `\"\"` means not supplied;\n- literal `\"Unknown\"` means the fact cannot currently be established;\n- integer `0` means a dated evidence source proved zero. Zero requires an evidence reference, evidence type and capture time.\n- `planned` describes intended configuration. It cannot prove an `observed` connection, submission, activity, membership or routing event.\n\nUse exact account, ad account, Page, form, Marketo subscription, LaunchPoint service, field, program/list and routing identity. Preserve long IDs byte-for-byte. Each observed state needs a typed dated evidence reference in the evidence register: `native_readback`, `native_receipt`, `source_report`, `operator_note`, or (only for the clearly marked fixture) `fictional_example_receipt`. Public documentation is `documented_source` and can support setup steps only. Do not treat it as native evidence.\n\nReturn the complete JSON record and a readable Markdown rendering of the same facts. Then return the decision (`DRAFT_READY`, `LAUNCH_HOLD`, `VERIFIED`, or `REPAIR_REQUIRED`), first broken state, exact next evidence request and one same-cohort, same-cutoff reconciliation with these seven populations: submitted, connector_observed, person_activity, membership, routed, duplicate, unresolved. A connector count may remain `Unknown` when the native service exposes no separate receipt.\n\nEvaluate in this order: authorization; account/form scope; field/value map; LinkedIn source test; Marketo person/activity; list/program membership; downstream routing; reconciliation. Stop at the first failed or contradictory state and keep later states unknown. Use `DRAFT_READY` when the plan is complete enough for operator review and no execution claim is being made. Use `LAUNCH_HOLD` when execution is expected but required authorization or test proof is missing. Use `REPAIR_REQUIRED` for malformed input, contradictory evidence or a proven failed step. Use `VERIFIED` only for the exact tested cohort after all required observed proof and reconciliation pass.\n\nFixture requirements: reason through each fixture and state what output/first break is expected. Do not blend fixture facts into the user's record.\n1. COMPLETE: use only the supplied complete fictional Copperline Systems record. It has one test submission at 2026-10-08 14:05 UTC, person MK-P-10482/activity at 14:06, membership at 14:06, routing at 14:07; submitted/person_activity/membership/routed = 1, duplicate/unresolved = 0 with fictional dated receipts, connector_observed = literal Unknown because no separate receipt was exposed. Expected fixture disposition: VERIFIED, explicitly fictional.\n2. MISSING: remove observed authorization, source test and activity receipts but leave the plan/mappings. Expected: LAUNCH_HOLD; name the earliest missing state and request current LaunchPoint status/authorization evidence. Do not turn blank into false or zero.\n3. WRONG SCOPE: observed Business Account or form ID differs from approved scope, even if the connection status says active. Expected: REPAIR_REQUIRED at account_form_scope; ask for the exact native account/form read-back. Do not continue to mapping/routing.\n4. STALE AUTH: authorization date is blank or outside the documented one-year service window. Expected: LAUNCH_HOLD at authorization; request current service status and authorization date. Do not reauthorize without an authorized operator.\n5. KNOWN ZERO: submitted=0 with dated source evidence; routed count is blank; unresolved is literal Unknown. Expected: preserve 0, blank, and Unknown separately; LAUNCH_HOLD at population_evidence and request same-cutoff routed/unresolved counts.\n6. MALFORMED: change `populations` to a scalar and remove `scope.form_id`. Expected: do not throw or coerce; return `REPAIR_REQUIRED` at import_contract with original supplied input preserved byte-for-byte or an exact escaped source copy, plus path/kind/value diagnostics. Do not overwrite the last accepted record.\n\nDo not use `VERIFIED` for a real-world record based on a prompt fixture, plan, public page, screenshot without native context, or unsupported narrative.\n\nPhase contract: an incomplete plan returns LAUNCH_HOLD at planning; a complete plan with no execution claim returns DRAFT_READY; launch requires current authorization, exact scope and a valid map; post_test requires the source receipt and checks each downstream state. Missing evidence holds at that state. Observed contradictions or failed outcomes return REPAIR_REQUIRED at the first affected state. A complete no-execution plan is DRAFT_READY in both builder and reviewer; the completely blank template is LAUNCH_HOLD at planning in both. Never imply launch authorization from DRAFT_READY.\n\nFresh fixture set: COMPLETE (VERIFIED only as fictional), PLAN_ONLY (DRAFT_READY), WRONG_SCOPE (REPAIR_REQUIRED/account_form_scope), STALE_AUTH (LAUNCH_HOLD/authorization), KNOWN_ZERO_MISSING (LAUNCH_HOLD/population_evidence while preserving 0/blank/Unknown), MALFORMED (REPAIR_REQUIRED/import_contract with exact bytes), EMPTY_ENUM (REPAIR_REQUIRED/field_value_map), MISSING_MATCHING_RECEIPT (REPAIR_REQUIRED/matching), WRONG_ACTIVITY (REPAIR_REQUIRED/person_activity), REJECTED_ROUTE (REPAIR_REQUIRED/routing), OUT_OF_CUTOFF (LAUNCH_HOLD/population_evidence). Explicit regression fixtures: NEW_PERSON_SUCCESS, EXISTING_PERSON_SUCCESS, TWO_SUBMISSIONS_ONE_PERSON, MISSING_ACTIVITY, ABSENT_MEMBERSHIP, REJECTED_ROUTING and UNRESOLVED_SOURCE_ROW.\n\nComplete field-by-field schema and allowed literals are in the attached `schema` object in this prompt package. Source links and exact evaluator commands are in `source_links` and `invocations`. When those files are available, run the evaluator on the unchanged input and report its first broken state; do not substitute prose judgment for executable evaluation.\n\nPopulation-unit rule: `person_activity` counts distinct Marketo people represented at least once in this cohort with the exact form-fill activity. `duplicate` counts only additional source submissions after the first submission for a person already represented in this same cohort. A source submission that matches a person who existed before the cohort still belongs in `person_activity`; that pre-existing identity does not make the submission a duplicate. `unresolved` counts source submissions in neither category. These categories must be mutually exclusive before applying `submitted = person_activity + duplicate + unresolved`. A known `unresolved` count above zero returns REPAIR_REQUIRED at reconciliation."
    },
    "review": {
      "title": "Independent integration record reviewer",
      "text": "LINKEDIN–MARKETO INTEGRATION RECORD REVIEWER — portable v1\n\nIndependently review the attached record and any attached evidence. This prompt is self-contained; do not assume access to this webpage, private accounts, code, other files, or prior conversation. Do not repair the source record silently. Return a read-only evaluation with disposition `DRAFT_READY`, `LAUNCH_HOLD`, `VERIFIED`, or `REPAIR_REQUIRED`, first broken state, exact evidence request, validation findings by JSON path, and population arithmetic only when definitions/cutoffs match.\n\nEvidence contract: distinguish planned from observed. Require exact evidence types and capture times. `documented_source` supports instructions, not native account state. Positive native claims require `native_readback`, `native_receipt`, or `source_report` as appropriate. `operator_note` is not a native receipt. Permit `fictional_example_receipt` only when `example_only:true`, and label the entire outcome fictional. Never treat a nonempty evidence string, public setup page, connection label, or generic screenshot as sufficient proof.\n\nCount contract: evaluate exactly these seven population keys: `submitted`, `connector_observed`, `person_activity`, `membership`, `routed`, `duplicate`, and `unresolved`. Empty string = blank; literal `Unknown` = unknown; nonnegative integer including `0` = known count. A zero is valid only with a dated compatible evidence item. Never coerce missing/Unknown to zero. Check one cohort, form/account scope, cutoff and timezone. Verify submitted = person/activity + duplicate + unresolved only when the populations share compatible record-level definitions and evidence. Check membership <= person/activity and routed <= membership only when the same unit and cohort are established. Do not force totals across incompatible populations.\n\nRequired nested validation: scope identity strings; connection planned and observed objects; every field mapping and allowed-values array; destination and matching objects; test submission and activity fields; cutoff; each of all seven population objects; every evidence register item and evidence type. Detect null/scalar/wrong-kind/missing members. Preserve malformed source bytes and last accepted state; return nonthrowing `REPAIR_REQUIRED` with exact path, expected kind, received kind and original value. Do not normalize malformed input into a valid default.\n\nEvaluate first broken state in this order: authorization, account_form_scope, field_value_map, source_test, person_activity, membership, routing, reconciliation. Use `DRAFT_READY` for a structurally complete plan that makes no execution claim. Use `LAUNCH_HOLD` when execution is expected but proof is absent. Use `REPAIR_REQUIRED` for malformed input, contradictory evidence or a proven failed step. Full typed, dated evidence for the exact cohort may be `VERIFIED`. Unknown connector receipt is acceptable only when explicitly unavailable and cannot be counted as zero.\n\nRun these independent cases and report exact outcomes: (1) COMPLETE fictional Copperline: IDs LI-ACCT-4821, FORM-DEMO-Q4, service LinkedIn Lead Gen - NA, program PRG-LI-DEMO-Q4, route CRM-QUEUE-ENTERPRISE; test 14:05 UTC, activity/person 14:06, membership 14:06, route 14:07 on 2026-10-08; counts 1/Unknown/1/1/1/0/0. Expected VERIFIED as fictional example only. (2) MISSING receipts with plan retained: LAUNCH_HOLD at first required missing observed state. (3) WRONG SCOPE: different observed form or Business Account: REPAIR_REQUIRED at account_form_scope. (4) STALE AUTH: missing or > one-year-old authorization date: LAUNCH_HOLD at authorization. (5) KNOWN ZERO: submitted=0 with evidence, routed blank, unresolved=\"Unknown\": preserve all three; LAUNCH_HOLD at population_evidence, request both missing populations. (6) MALFORMED: populations scalar, missing scope.form_id, nested evidence item with numeric `captured_at`, and/or evidence type `\"planned to verify later\"`: REPAIR_REQUIRED, path-specific diagnostics, exact input preservation; no exception and no commit.\n\nReturn concise evaluation JSON plus a plain-language handoff. Keep the attached source record unchanged. Never infer a cause from timing, blame a person, authorize a test/reconnect, or claim a real-world result.\n\nPhase contract: an incomplete plan returns LAUNCH_HOLD at planning; a complete plan with no execution claim returns DRAFT_READY; launch requires current authorization, exact scope and a valid map; post_test requires the source receipt and checks each downstream state. Missing evidence holds at that state. Observed contradictions or failed outcomes return REPAIR_REQUIRED at the first affected state. A complete no-execution plan is DRAFT_READY in both builder and reviewer; the completely blank template is LAUNCH_HOLD at planning in both. Never imply launch authorization from DRAFT_READY.\n\nFresh fixture set: COMPLETE (VERIFIED only as fictional), PLAN_ONLY (DRAFT_READY), WRONG_SCOPE (REPAIR_REQUIRED/account_form_scope), STALE_AUTH (LAUNCH_HOLD/authorization), KNOWN_ZERO_MISSING (LAUNCH_HOLD/population_evidence while preserving 0/blank/Unknown), MALFORMED (REPAIR_REQUIRED/import_contract with exact bytes), EMPTY_ENUM (REPAIR_REQUIRED/field_value_map), MISSING_MATCHING_RECEIPT (REPAIR_REQUIRED/matching), WRONG_ACTIVITY (REPAIR_REQUIRED/person_activity), REJECTED_ROUTE (REPAIR_REQUIRED/routing), OUT_OF_CUTOFF (LAUNCH_HOLD/population_evidence). Explicit regression fixtures: NEW_PERSON_SUCCESS, EXISTING_PERSON_SUCCESS, TWO_SUBMISSIONS_ONE_PERSON, MISSING_ACTIVITY, ABSENT_MEMBERSHIP, REJECTED_ROUTING and UNRESOLVED_SOURCE_ROW.\n\nComplete field-by-field schema and allowed literals are in the attached `schema` object in this prompt package. Source links and exact evaluator commands are in `source_links` and `invocations`. When those files are available, run the evaluator on the unchanged input and report its first broken state; do not substitute prose judgment for executable evaluation.\n\nPopulation-unit rule: `person_activity` counts distinct Marketo people represented at least once in this cohort with the exact form-fill activity. `duplicate` counts only additional source submissions after the first submission for a person already represented in this same cohort. A source submission that matches a person who existed before the cohort still belongs in `person_activity`; that pre-existing identity does not make the submission a duplicate. `unresolved` counts source submissions in neither category. These categories must be mutually exclusive before applying `submitted = person_activity + duplicate + unresolved`. A known `unresolved` count above zero returns REPAIR_REQUIRED at reconciliation."
    }
  },
  "fixture_ids": [
    "COMPLETE",
    "PLAN_ONLY",
    "WRONG_SCOPE",
    "STALE_AUTH",
    "KNOWN_ZERO_MISSING",
    "MALFORMED",
    "EMPTY_ENUM",
    "MISSING_MATCHING_RECEIPT",
    "WRONG_ACTIVITY",
    "REJECTED_ROUTE",
    "OUT_OF_CUTOFF",
    "NEW_PERSON_SUCCESS",
    "EXISTING_PERSON_SUCCESS",
    "TWO_SUBMISSIONS_ONE_PERSON",
    "MISSING_ACTIVITY",
    "ABSENT_MEMBERSHIP",
    "REJECTED_ROUTING",
    "UNRESOLVED_SOURCE_ROW"
  ],
  "fixtures": [
    {
      "id": "COMPLETE",
      "expected": "VERIFIED",
      "first_broken_state": null
    },
    {
      "id": "PLAN_ONLY",
      "expected": "DRAFT_READY",
      "first_broken_state": null
    },
    {
      "id": "WRONG_SCOPE",
      "expected": "REPAIR_REQUIRED",
      "first_broken_state": "account_form_scope"
    },
    {
      "id": "STALE_AUTH",
      "expected": "LAUNCH_HOLD",
      "first_broken_state": "authorization"
    },
    {
      "id": "KNOWN_ZERO_MISSING",
      "expected": "LAUNCH_HOLD",
      "first_broken_state": "population_evidence"
    },
    {
      "id": "MALFORMED",
      "expected": "REPAIR_REQUIRED",
      "first_broken_state": "import_contract"
    },
    {
      "id": "EMPTY_ENUM",
      "expected": "REPAIR_REQUIRED",
      "first_broken_state": "field_value_map"
    },
    {
      "id": "MISSING_MATCHING_RECEIPT",
      "expected": "REPAIR_REQUIRED",
      "first_broken_state": "matching"
    },
    {
      "id": "WRONG_ACTIVITY",
      "expected": "REPAIR_REQUIRED",
      "first_broken_state": "person_activity"
    },
    {
      "id": "REJECTED_ROUTE",
      "expected": "REPAIR_REQUIRED",
      "first_broken_state": "routing"
    },
    {
      "id": "OUT_OF_CUTOFF",
      "expected": "LAUNCH_HOLD",
      "first_broken_state": "population_evidence"
    },
    {
      "id": "NEW_PERSON_SUCCESS",
      "expected": "VERIFIED",
      "first_broken_state": null
    },
    {
      "id": "EXISTING_PERSON_SUCCESS",
      "expected": "VERIFIED",
      "first_broken_state": null
    },
    {
      "id": "TWO_SUBMISSIONS_ONE_PERSON",
      "expected": "VERIFIED",
      "first_broken_state": null
    },
    {
      "id": "MISSING_ACTIVITY",
      "expected": "REPAIR_REQUIRED",
      "first_broken_state": "person_activity"
    },
    {
      "id": "ABSENT_MEMBERSHIP",
      "expected": "REPAIR_REQUIRED",
      "first_broken_state": "membership"
    },
    {
      "id": "REJECTED_ROUTING",
      "expected": "REPAIR_REQUIRED",
      "first_broken_state": "routing"
    },
    {
      "id": "UNRESOLVED_SOURCE_ROW",
      "expected": "REPAIR_REQUIRED",
      "first_broken_state": "reconciliation"
    }
  ],
  "schema": {
    "schema_version": "maestro.linkedin-marketo-integration.v1",
    "record": {
      "record_id": "string",
      "example_only": "boolean",
      "evaluation_phase": [
        "draft",
        "launch",
        "post_test"
      ],
      "scope": [
        "organization",
        "linkedin_user_ref",
        "business_account_id",
        "ad_account_id",
        "page_id",
        "form_name",
        "form_id",
        "marketo_subscription_ref",
        "launchpoint_service_name",
        "launchpoint_service_id",
        "approved_by",
        "approved_at"
      ],
      "connection": {
        "planned": [
          "status",
          "steps_or_reference",
          "owner"
        ],
        "observed": [
          "status",
          "authorized_at",
          "checked_at",
          "evidence_ref",
          "business_account_id",
          "ad_account_id",
          "page_id",
          "form_id"
        ]
      },
      "field_mappings": {
        "type": "array of objects",
        "fields": [
          "linkedin_field",
          "marketo_field",
          "data_type",
          "normalization",
          "allowed_values",
          "consent_action",
          "required",
          "state",
          "evidence_ref",
          "observed_values"
        ],
        "data_type": [
          "email",
          "text",
          "enum",
          "boolean",
          "number",
          "date",
          "phone",
          "url",
          "integer",
          "decimal"
        ]
      },
      "destination": [
        "type",
        "name",
        "id",
        "smart_campaign_name",
        "smart_campaign_id",
        "trigger_or_filter",
        "qualification_rule",
        "flow_action",
        "membership_status_expected",
        "observed_membership_status",
        "observed_at",
        "evidence_ref",
        "membership_outcome"
      ],
      "matching": [
        "match_rule",
        "dedupe_behavior",
        "collision_or_merge",
        "observed_at",
        "evidence_ref",
        "observed_outcome"
      ],
      "routing": [
        "destination",
        "event",
        "owner",
        "response_target",
        "observed_event",
        "observed_at",
        "evidence_ref",
        "outcome"
      ],
      "test": [
        "authorized_by",
        "submitted_at",
        "timezone",
        "test_person_ref",
        "test_lead_flag",
        "linkedin_evidence_ref",
        "marketo_person_id",
        "activity_name",
        "activity_at",
        "person_activity_evidence_ref",
        "activity_outcome"
      ],
      "cutoff": [
        "start",
        "end",
        "timezone",
        "cohort",
        "form_id",
        "ad_account_id"
      ],
      "populations": {
        "exact_keys": [
          "submitted",
          "connector_observed",
          "person_activity",
          "membership",
          "routed",
          "duplicate",
          "unresolved"
        ],
        "fields": [
          "state",
          "value",
          "evidence_ref",
          "evidence_type",
          "captured_at",
          "definition",
          "evidence_scope"
        ],
        "state": [
          "KNOWN",
          "UNKNOWN",
          "BLANK"
        ],
        "evidence_scope": [
          "form_id",
          "ad_account_id",
          "cohort",
          "cutoff_start",
          "cutoff_end",
          "timezone"
        ]
      },
      "evidence": {
        "type": "array of objects",
        "fields": [
          "evidence_ref",
          "evidence_type",
          "captured_at",
          "supports",
          "note"
        ],
        "evidence_type": [
          "native_readback",
          "native_receipt",
          "source_report",
          "operator_note",
          "documented_source",
          "fictional_example_receipt only when example_only=true"
        ]
      },
      "operator_notes": "string"
    },
    "dispositions": [
      "DRAFT_READY",
      "LAUNCH_HOLD",
      "VERIFIED",
      "REPAIR_REQUIRED"
    ],
    "first_broken_states": [
      "planning",
      "authorization",
      "account_form_scope",
      "field_value_map",
      "source_test",
      "matching",
      "person_activity",
      "membership",
      "routing",
      "population_evidence",
      "reconciliation",
      "import_contract"
    ],
    "outcomes": {
      "matching": [
        "NO_COLLISION",
        "MATCHED_EXISTING",
        "MERGED",
        "UNRESOLVED_COLLISION",
        "UNKNOWN"
      ],
      "activity": [
        "OBSERVED",
        "MISSING",
        "WRONG_ACTIVITY",
        "UNKNOWN"
      ],
      "membership": [
        "PRESENT",
        "ABSENT",
        "NOT_REQUIRED",
        "UNKNOWN"
      ],
      "routing": [
        "ACCEPTED",
        "REJECTED",
        "NOT_REQUIRED",
        "UNKNOWN"
      ]
    },
    "population_rules": [
      "Known values are nonnegative integers with matching dated evidence.",
      "Unknown and blank have null value.",
      "Every known population has exact form/account/cohort/cutoff/timezone scope.",
      "person_activity counts distinct Marketo people represented at least once in the cohort with the exact form-fill activity.",
      "duplicate counts only additional source submissions after the first for a person already represented in the same cohort; a pre-existing person is not a duplicate by itself.",
      "person_activity, duplicate and unresolved are mutually exclusive before reconciliation.",
      "submitted = person_activity + duplicate + unresolved.",
      "membership <= person_activity and routed <= membership.",
      "A known unresolved count above zero returns REPAIR_REQUIRED at reconciliation."
    ]
  },
  "source_links": [
    {
      "name": "LinkedIn Lead Gen Forms and CRM integration",
      "url": "https://www.linkedin.com/help/lms/answer/a423205"
    },
    {
      "name": "Marketo LaunchPoint services",
      "url": "https://experienceleague.adobe.com/en/docs/marketo/using/product-docs/administration/additional-integrations/launchpoint/launchpoint-services"
    },
    {
      "name": "Marketo Add to List flow action",
      "url": "https://experienceleague.adobe.com/en/docs/marketo/using/product-docs/core-marketo-concepts/smart-campaigns/flow-actions/add-to-list"
    }
  ],
  "invocations": {
    "python": "python3 marketo-integration-checker.py RECORD.json",
    "python_phase": "python3 marketo-integration-checker.py --phase draft|launch|post_test RECORD.json",
    "node": "node marketo-integration-checker.mjs RECORD.json",
    "node_phase": "node marketo-integration-checker.mjs --phase draft|launch|post_test RECORD.json"
  }
}
