Foresight.Reflect.EntailmentGate (Foresight v0.1.0)

Copy Markdown View Source

Backend-agnostic grounding gate for D4. Splits a reflect answer into clauses, asks the configured EntailmentVerifier whether the cited-memory text entails each, and applies the pass/fail policy — returning the unsupported clauses so the agentic loop can re-enter targeting exactly what wasn't grounded.

This module owns the clause split and the policy; the verifier owns only the per-clause judgement. Opts:

  • :entailment_verifier — verifier module (default EntailmentVerifiers.Noop, i.e. off). All other opts pass through to the verifier (:llm, :provider, …).
  • :entailment_min_supported — fraction of clauses that must be supported to pass (default 1.0 — every clause must be grounded).

Safe by construction: a blank answer passes (nothing to verify), and a verifier that returns a malformed result is treated as all-supported so a broken gate never blocks an answer.

Summary

Functions

Check that answer's clauses are entailed by evidence (cited-memory text).

Types

result()

@type result() :: %{
  passed?: boolean(),
  clauses: [String.t()],
  verdicts: [Foresight.Reflect.EntailmentVerifier.verdict()],
  unsupported_clauses: [String.t()]
}

Functions

check(answer, evidence, opts \\ [])

@spec check(String.t(), [String.t()], keyword()) :: result()

Check that answer's clauses are entailed by evidence (cited-memory text).