Keep a record of the material used
Lesson bodies, supported document extracts and transcripts enter Laravel as canonical sources, versions, segments and chunks through a dedicated AI connection. Ingestion records each run. An attached file isn't automatically extractable, and empty normalized text stays unavailable even if an earlier record says ready.
A version records its source type, provider, model, language and content hash. Matching material can reuse a version; new current content supersedes older ready versions. Shared selection code excludes transcripts attached to replaced media, and saved-guide readiness checks the output against current lesson material.
Carry access and source references through the answer
Assistant access starts with feature enablement, enabled enrollment and course rollout, then checks the requested course and lesson. Retrieval combines lexical candidates with configured vector results. PostgreSQL search and the opt-in PHP fallback are separate paths, and vectors still need an embedding provider. Python only receives candidates after these access checks.
Laravel generates from the selected context, validates the structured response and asks the verifier which claims have support. It filters citations by supporting chunk IDs, checks their count and verifies the intended lesson. Weak support, missing coverage, malformed output and provider failure lead to different response paths.
That keeps source selection, access and answer checks connected without treating a retrieval score as permission or proof. This note describes the implementation; no running index, current provider configuration or live answer was checked.