AddThisFeature

Retrieval-Augmented Generation

Ground AI answers in the app's own content by retrieving source passages first.

involved AI Analysis & Search

What it adds

A retrieval layer that selects permitted passages from app content and supplies them to the model as cited evidence.

What your agent is told to do

5
  1. 1

    Decide which content is answerable from and treat everything else as out of scope. A retrieval feature pointed at the whole database returns confident answers about records nobody meant to expose.

  2. 2

    Apply the requesting user's tenant, record, and field permissions during retrieval, before any passage is assembled into a request. Filtering the answer afterwards is too late — the content has already crossed the boundary.

  3. 3

    Chunk on the content's own structure — sections, headings, rows, message boundaries — and carry enough surrounding context in each chunk that it still means something on its own.

  4. 4

    Cite the passages behind every answer with a link back to the source record, and when nothing clears the relevance threshold, say there is no answer in the available sources rather than letting the model fill the gap.

  5. 5

    Keeping the index current — ingesting, versioning, and removing sources — belongs to Knowledge Source Sync. This entry owns query-time retrieval and generation only, and must not build a second ingestion path.

Edge cases it handles

8
  • A chunk that splits a table from its header, a clause from its definition, or an answer from its question is worse than no chunk at all, because it retrieves well and reads wrongly.
  • Permission filtering has to happen at retrieval, and it must reflect permissions as they are now, not as they were when the content was indexed.
  • Exact identifiers, error codes, and product names are found by keyword matching and missed by meaning-based search, while paraphrased questions are the reverse. Combine both and merge the results rather than picking one.
  • Passing more passages than are needed degrades the answer as well as costing more. Cap the assembled context by relevance and by a token ceiling, and drop the tail rather than truncating mid-passage.
  • When the evidence is thin or contradictory, the answer must say so and show the conflicting sources instead of silently choosing one.
  • Retrieved content is untrusted input and may contain instructions aimed at the model. Handling that is owned by Prompt Injection Defense; this feature must pass retrieved passages through as data and not as instructions.
  • When the model is unavailable or times out, degrade to showing the retrieved passages themselves as search results. A grounded feature still has something useful to display without generation.
  • A question about content the user cannot see must return the same no-answer response as a question about content that does not exist, or the difference between the two leaks the record's existence.

Definition of done

9
  • Retrieval is filtered by the requesting user's current tenant and record permissions before any passage leaves the application.
  • Every generated answer carries citations that link to the source records they came from.
  • Insufficient or below-threshold evidence produces an explicit no-answer response rather than an ungrounded one.
  • Both keyword and semantic retrieval contribute to the candidate set and their results are merged.
  • Assembled context is bounded by a relevance cutoff and a token ceiling, with whole passages dropped rather than cut.
  • A model outage degrades the feature to retrieval-only results instead of an error page.
  • Ingestion is delegated to Knowledge Source Sync and not duplicated here.
  • The feature matches the existing design system.
  • No existing functionality is broken.

Related features

How it works

  1. 1

    Copy the link

    Grab the Markdown instruction URL for this feature.

  2. 2

    Give it to your AI

    Paste it into Claude Code, Cursor, v0, Lovable — whatever you build with.

  3. 3

    It inspects, then implements

    Your agent reads your existing app first, then adds the feature to fit it.

Works with your stack

These instructions are written to adapt. They tell the agent to detect your framework, match your existing design system, and reuse what you already have — rather than assuming a particular stack.

Need it tighter than that? Customize the feature and tell it exactly what you're running.