LeadRefinery — How the Platform Works

Outcome resolution

Traced at commit ffe4e48; extraction and review re-traced at e53d0dc · libs/contracts/src/lib/{vector-resolution,extractor,compliance,canonicalization,review-queue}.ts · libs/temporal/src/activities/call-attempt.ts

Summary

  1. A finished call becomes seven dimensions and one headline.
  2. Three dimensions come from facts the platform already holds. The platform decides these first.
  3. Three dimensions describe the conversation. These are less certain.
  4. The provider analysis fills what it can.
  5. A phrase list and then a language model fill only the dimensions that are still empty.
  6. A model can never overwrite a dimension that a certain source decided.
  7. The platform discards a model answer of UNKNOWN. The platform does not store it.
  8. An undecided headline, or a weak extraction, sends the call to a person.

Workflow 1 — the seven dimensions

A table of the seven dimensions. D1 Connection records how the call connected and comes from the carrier result and answering-machine detection. D5 Compliance records flags such as a stop request and comes from the provider analysis or a fixed phrase list, as a union. D6 Action records what the agent did and comes from the tools it called. Those three are certain. D2 Party records who answered, D3 Intent what they intend, D4 Qualification whether they qualify and D7 Scenario which offer the call is about; all four come from the provider analysis and then a language model. The headline is derived from the dimensions above and never comes from a model.
Workflow 1 of 3 — the inputs. Seven dimensions and one headline. Three are certain and four are not.

Workflow 2 — the order of resolution

A finished call becomes seven dimensions and one headline. Step 1 decides three certain dimensions from facts the platform already holds: how the call connected, which compliance flags were raised, and which tools the agent used. These are then fixed. Step 2 fills who answered, what they intend and whether they qualify. First the voice provider’s own analysis fills what it can. Then a fixed phrase list, and after it a language model, fill only the dimensions still empty. The result is one outcome written once, or a person reviews the call when the headline stays undecided or the extraction is weak.
Certain sources first. The platform keeps model answers only for the empty dimensions.

Step 1 — the certain dimensions

  1. D1, how the call connected. The system derives this from the carrier result and the answering-machine detection.
  2. D5, compliance flags. The system derives this from the provider analysis and from a fixed phrase list.
  3. D6, what the agent did. The system derives this from the tools the agent called and from confirmed system markers.
  4. These three dimensions are now fixed.
  5. No later step may change them.

Step 2 — the uncertain dimensions

  1. D2 records who answered.
  2. D3 records what the person intends.
  3. D4 records whether the person qualifies.
  4. The provider analysis fills these dimensions where it can.
  5. A phrase list then reads the transcript. A phrase match replaces the model answer.
  6. A language model reads the transcript too. The platform uses its answer only where no phrase matched.
  7. The model answers all four language dimensions. The platform keeps only the answers for empty dimensions.
  8. The platform discards a model answer of UNKNOWN.
  9. An absent answer therefore never displaces a real answer.
  10. A rehearsal runs the same steps against an impersonated model.
  11. See D2, D3 and D4 for the rules of each dimension.

The order is the safeguard. A model cannot overwrite a fact. The code never offers the model a dimension that a certain source decided. Change the order and a confident sentence in a transcript can overrule a carrier result.

D5 is different on purpose

  1. Every other dimension uses a waterfall. The first source to answer wins.
  2. D5 uses a union. Every source that answers contributes.
  3. The provider analysis can raise a flag.
  4. The fixed phrase list can raise a flag.
  5. One source is sufficient.
  6. A missed compliance flag is not a data-quality problem. It is a regulatory event.
  7. See D5 — compliance flags for the two sources and all seven flags.
  8. See Opt-outs for the flag that carries the most consequence.

Who writes the analysis, and how the transcript checks it

Traced at commit cf34e2f · libs/contracts/src/lib/{vector-resolution,compliance}.ts · apps/worker/src/main.ts

  1. On this page, “the provider analysis” means the answers to the post-call fields.
  2. In production the platform writes those answers itself, with POST_CALL_ANALYSIS=platform and an OpenAI model.
  3. The production and demo agents carry no post-call analysis fields at Retell.
  4. Retell still sends call_analyzed. It holds only the default summary.
  5. The resolver reads the three compliance facts against the transcript before it keeps the model answer.
  6. groundedDisclosure reads each half of the disclosure, AI and recording.
  7. The words of the half in the agent lines count as a delivery. The model answer does not matter then.
  8. A model no on a call where the agent never spoke after the first caller turn becomes unknown.
  9. That call ended before the disclosure. It is not a miss.
  10. In every other case the model answer stands. A real miss still reads no.
  11. groundedClaim reads made_prohibited_claim.
  12. A claim of rate_or_term, funding_amount or approval needs its words in the agent lines.
  13. Those words are a figure, an amount or approval words.
  14. Without them the claim reads no, and the call goes to compliance review.
  15. A claim of other keeps the model answer.
  16. The disclosure alert and the campaign audit count a miss only on calls of 20 s or more.
  17. The constant is DISCLOSURE_ALERT_MIN_CALL_SECONDS. The call row keeps the resolved value at any length.

Workflow 3 — when a person reviews the call

Three routes send a finished call to the review queue. First, no source decided the headline, so it is still needs review; the queue records the reason unknown dimension. Second, the provider analysis never arrived, and the workflow disposed the call as needs review; the reason is also unknown dimension. Third, extraction decided the headline but not firmly: it left D2, D3 or D4 empty, returned UNKNOWN for D2 or D3, or used a confidence below 0.7; the reason is low confidence. A headline that a certain source or the provider analysis decided has no route to the queue, whatever its confidence. A person then confirms or corrects each dimension, and each correction is recorded against the original value. A rehearsal attempt reaches the queue only inside a tagged simulation run.
Workflow 3 of 3 — the human path. Three routes in. A headline that the provider decided has no route at all.
  1. The certain sources and the provider analysis run first. A headline that they decide never goes to review.
  2. A headline that stays needs_review goes to review with the reason unknown_dimension.
  3. The workflow disposes a call as needs_review when the analysis never arrives. See A call from start to end.
  4. Extraction can decide a needs_review headline. The platform then checks how firmly it decided.
  5. The call goes to review with the reason low_confidence if D2, D3 or D4 stays empty.
  6. The same applies if D2 or D3 is UNKNOWN.
  7. It also applies if a value that the headline used has confidence below 0.7.
  8. A phrase match has confidence 0.80 or more. A phrase match alone never triggers this check.
  9. A rehearsal attempt reaches the queue only inside a tagged simulation run.
  10. The code also holds shouldRouteToReviewQueue and the reason extraction_failure. No production path uses either one.
  11. A person confirms or corrects each dimension.
  12. The platform records each correction against the original value.
  13. Those corrections are the only measurement of extraction quality against real calls.
  14. Review is a normal outcome. It is not a failure.

A call from start to end — how the transcript reaches this point.
D2 — who answered, D3 — intent and D4 — qualification — the three uncertain dimensions, one page each.