The workflow
1. Ask
The user asks a question in the AI host. The host calls the search tool with the query and the user's identity context.
2. Retrieve
The server searches only the corpus the user may read, returns ranked summaries with source URLs and modified dates.
3. Read
The host requests one document by ID. The server rechecks access and returns approved text.
4. Answer with citations
The host answers and cites the source. If retrieval returns nothing, the instruction is to say so, not to improvise.
5. Improve
Zero-result queries and missing documents become content work, not prompt tweaks.
Reference flow
Retrieval is authorized before it is ranked.
question
-> search_documents(query, filters, limit)
-> authorization filter (user, tenant, corpus)
-> lexical + vector retrieval
-> results with source_url, updated_at, score
-> read_document(document_id)
-> recheck access
-> approved text + citation metadata
-> answer + citationsTool surface
| Tool | Purpose | Control |
|---|---|---|
| search_documents | Find candidate sources | Access-filtered, 10 results, snippet only |
| read_document | Fetch approved text | Rechecks access, max length, source metadata |
| list_sources | Show what is indexed | Corpus names and freshness, no private paths |
| get_document_status | Check freshness and owner | Last indexed, owner, superseded flag |
Controls that make it trustworthy
| Risk | Control |
|---|---|
| Assistant sees a document the user cannot | Retrieval filtered by the user's access, not a shared service account |
| Answer cites an old policy | Effective date and superseded flag in results; stale sources are labeled |
| Answer invents a citation | Citations come from tool output fields, not from the model |
| Document contains an instruction | Retrieved text is fenced as untrusted data in the host and never treated as policy |
| Index leaks deleted documents | Deletion propagates to the index within the agreed window |
What to measure
- Citation rate: answers that include a source link.
- Zero-result rate by query family, reviewed weekly.
- Retrieval p95 latency and index freshness lag.
- Access-denied rate, to distinguish permission bugs from missing content.
- User correction rate, sampled, with the failing source recorded.
Questions people ask before starting
Do we need a vector database?
Not always. Start with lexical search if it meets the need, then add embeddings for fuzzy language. The retrieval choice is a scope decision, not a default.
Can it cite exact passages?
Yes, if the source includes stable anchors or page numbers. We return those fields so the host can link to the passage rather than the document root.
How do permissions stay current?
The server checks access on every retrieval and read, using your identity provider or a synchronized permission table. Caches are keyed by user and tenant and expire.
What content should not be indexed?
Drafts, legal holds, personal data without a basis, and anything the source system marks restricted. The corpus definition is part of the security review.
Next step
Map your knowledge boundary
List the corpora, who may read them and how freshness is decided. That is enough to scope the first version.
Last verified .