Writing · 2026-05-14

Grounding an eligibility assistant without giving the model the keys

How policy ingestion, Bedrock Cohere embeddings, and full-document enrichment (FDE) produce a citable corpus in PostgreSQL/pgvector, while MCP keeps live Eligibility and Enrollment data behind authorized APIs.

  • Applied AI
  • RAG
  • MCP
  • Spring AI
  • AWS
Eligibility Assistant — offline path is ingest, embed, then FDE. Online path retrieves enriched passages, answers only from those passages, and uses MCP only when live E&E facts are required.

Public-benefits guidance for SNAP, Medicaid, and TANF must be explainable, current, and attributable to Federal and State of Maryland source text. The Eligibility and Enrollment (E&E) assistant was designed around that constraint. A conversational interface is not sufficient if the model can invent policy or receive unrestricted access to case systems.

The figure above is the operating model. Offline, the corpus is built through ingestion, embedding, and full-document enrichment (FDE). Online, the service retrieves approved passages, generates an answer only from those passages, and invokes MCP tools only when a live case or rule fact is required. The language model does not receive AWS credentials, database connection strings, or a complete case record in the default prompt.

Ingestion

Ingestion converts policy into processable text. It does not generate answers.

Federal and Maryland materials—statute, regulation, agency manuals, and curated extracts—are landed in object storage rather than on application servers. A processor detects new or replaced objects, records a document version, and extracts text from PDF or HTML. Headers, boilerplate, and low-quality scan artifacts are removed so embedding capacity is spent on policy language.

Chunking belongs in this layer. A benefits manual exceeds both a single vector and a single prompt window. Splitting follows section boundaries first, then token windows with overlap so a sentence that crosses a boundary remains retrievable. Each chunk carries source identity from creation: program (SNAP, Medicaid, or TANF), jurisdiction, document identifier, section heading, and effective date.

Ingestion does not call Claude or Nova. If generation is mixed into ingest, later citations cannot be distinguished from model paraphrase. When a manual is superseded, the prior version is marked not-for-retrieval so currency remains a data problem rather than a prompt-engineering problem.

Embeddings

An embedding is a dense vector representation of meaning. Cohere Embed on Amazon Bedrock converts each ingested chunk to a vector. Semantically related language sits closer in that space than unrelated program text—for example, “income disregard” and a question about countable SNAP income versus a TANF work-requirement paragraph.

Vectors are stored in PostgreSQL with pgvector, adjacent to chunk text. At query time the question is embedded with the same Cohere model. Changing the embedding model without re-indexing the corpus invalidates similarity search. Retrieval returns nearest neighbors, then applies filters for program and access metadata so a Medicaid question is not answered from a SNAP-only passage merely because the wording is similar.

Embeddings rank candidates; they are not answers. Embedding is performed in batch at ingest, idempotent on document version and chunk identifier. The request path is a query embedding plus an index lookup, not a scan of object storage. Evaluations of Claude and Nova addressed generation, classification, and routing—not replacement of Cohere as the vector model.

Full-document enrichment (FDE)

FDE is the step that promotes a vector to a record that may be shown to a model and cited to a human. A raw embedding without FDE is not served.

For each chunk, FDE persists the citation metadata required by both the user interface and the prompt:

  • parent document and version, so citations name the manual rather than an orphan fragment
  • section, page, or paragraph locator
  • program and effective date
  • access labels (applicant, caseworker, internal-only)
  • a hash of source text so an unannounced edit forces re-embedding

Parent and child remain linked: retrieval can return a tight chunk for the model while the citation displays the parent title. Chunks that fail extraction—empty text, unknown program, missing effective date—remain in an error state and never enter the nearest-neighbor set.

Only after FDE succeeds does the pgvector row become the retrieval record. Thin retrieval is therefore a product event: the service declines to invent policy rather than returning an unsourced answer.

Request path

On each question, Spring AI embeds the query, retrieves FDE-approved passages, and instructs the Bedrock model to answer only from those passages. Live case context uses a separate channel. MCP tools call controlled E&E case-data and eligibility-rule services when the conversation requires a fact from the system of record. Existing E&E systems remain that record.

Operations instrumentation records latency, token use, retrieval hit rate, and citation identifiers in Splunk. RAG is operated as a product over documents and APIs. Ingestion, embeddings, and FDE constitute the corpus factory. The model is the last mile; it is not granted the keys to the platform.

Discussion

Comments from readers and recruiters.

No comments yet. Be the first to leave a note for Subose or for other readers.