AddThisFeature

Document Question Answering

Let users ask questions about a document and get answers drawn only from that document.

involved AI Analysis & Search

What it adds

An extraction and retrieval pipeline over uploaded files, with answers that cite the passages they came from.

What your agent is told to do

5
  1. 1

    Extract text from each upload with the app's existing background-job system, and record per-page or per-section extraction status so unreadable parts are known rather than silently missing.

  2. 2

    Retrieve candidate passages first, then answer only from those passages. Instruct the model to say the document does not cover a question rather than filling the gap from general knowledge.

  3. 3

    Attach a citation to every claim, pointing at the specific passage and its location in the file, and make the citation open that location in the document viewer.

  4. 4

    Isolate extracted text and any derived index by tenant and by the document's own permissions, and re-check permission at query time rather than relying on the index being correctly partitioned.

  5. 5

    When a document is replaced or edited, mark its index stale immediately and block answers until re-extraction finishes. Do not serve answers from the previous version's passages under the new file's name.

Edge cases it handles

8
  • Scanned pages, images without text, password-protected files, and unsupported formats will appear. Report exactly which pages or sections could not be read and keep answering from the ones that could.
  • An answer with no citation is not trustworthy. If no retrieved passage supports the claim, return the no-answer state rather than an uncited paragraph.
  • The document not containing the answer is a correct outcome, not a failure. Say so plainly and offer the closest passages found, without inventing a synthesis.
  • Extracted text and any index derived from it inherit the document's access rules. A user who loses access to the file must immediately stop getting answers built from it.
  • Replacing a document must invalidate cached answers and prior citations. A citation pointing at a page number that no longer exists must be shown as expired, not followed blindly.
  • Very large documents will exceed both the extraction budget and the context window. Cap the file size accepted and tell the user the limit before they wait for an upload to fail.
  • If the model is unavailable, keep the document viewer and its full-text search working so the file is still usable.
  • Knowledge Base Chat answers across the app's published sources. This feature answers within a single user-supplied document; do not mix the two corpora in one answer.

Definition of done

8
  • Extraction runs in the background and records which pages or sections were unreadable.
  • Every answer carries citations that resolve to a location in the source document.
  • Questions the document does not cover return an explicit no-answer response rather than a generated one.
  • Extracted text and derived indexes are unreachable across tenants, and permission is verified at query time.
  • Replacing a document invalidates its index and its cached answers before any new question is answered.
  • Document viewing and keyword search continue to work when the model is unavailable.
  • 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.