Case study /04 · Delivered
Knowledge Copilot

Context
Every company has the same problem: policy docs, runbooks, contracts and wikis that contain the answer to almost any question — if anyone could find it. Generic chatbots hallucinate confidently; search returns forty links. The useful middle is grounded answering with provenance.
Problem
RAG fails quietly in three places: retrieval that misses the right passage, generation that drifts beyond what was retrieved, and permissions — the assistant must never synthesize an answer from documents the asking user cannot open. All three had to be engineered and measured, not assumed.
Constraints
- Answers had to carry passage-level citations a user can click and verify.
- Document permissions (ACLs) had to filter retrieval before generation, not after.
- Source documents change daily; the index could never drift stale silently.
- Quality had to be provable to stakeholders — an eval suite, not a demo.
Responsibilities
- Ingestion pipeline: parsing, structure-aware chunking, metadata and embedding generation.
- Hybrid retrieval combining vector similarity and keyword search, with a reranking stage.
- Permission-aware retrieval filtering against the organization's access model.
- Grounded generation with inline citations and refusal behavior.
- Evaluation harness with answerable and unanswerable question sets.
Architecture
- Documents flow through a staged ingestion pipeline — parse, chunk along structural boundaries, embed, index — with per-source sync watermarks so updates re-index incrementally.
- Retrieval is hybrid: dense vectors (pgvector) and keyword search run in parallel, results merge and pass through a reranker before the top passages reach the model.
- ACL filters apply inside the retrieval query itself, so unauthorized passages never enter the context window.
- Generation is constrained to retrieved context with citation markers per claim; a groundedness check flags answers that cite nothing.
- Every answer stores its full retrieval trace for debugging and evals.
Key decisions
- Hybrid retrieval over pure vector search: exact terms — invoice numbers, product names, legal phrases — are where pure embeddings embarrass themselves.
- Chunking follows document structure (headings, clauses, tables) instead of fixed token windows; retrieval quality moved more from chunking than from any model swap.
- Refusal is a feature: below a retrieval-confidence threshold the copilot says it doesn't know and shows the closest sources instead of improvising.
- Evals run on every prompt or pipeline change — a fixed suite of real questions with graded answers, including trap questions the corpus cannot answer.
Implementation
- Answer streaming starts as soon as generation begins; citations resolve progressively as claims complete.
- The reranking stage cut context size substantially — fewer, better passages beat a stuffed window on both cost and accuracy.
- Unanswerable-question sets keep refusal behavior calibrated release over release.
- Retrieval traces power an internal debugging view: what was fetched, what was ranked out, what the model actually cited.
Performance
- Incremental re-indexing keeps corpus freshness within minutes of source changes.
- Parallel dense + keyword retrieval keeps end-to-end answer latency interactive.
- Context discipline (reranked top-k) holds token costs flat as the corpus grows.
Outcomes
- A copilot whose answers are verifiable — every claim traces to a passage the user can open.
- Permission-aware retrieval held up under audit: no cross-ACL leakage paths.
- The eval harness turned model and prompt upgrades from gut calls into measured decisions.
- [PLACEHOLDER — add corpus size, usage and accuracy figures when publishable.]
Lessons
- Retrieval quality is the product; the LLM only narrates what retrieval found.
- Unanswerable questions are the most important part of any eval set.
- Citations change user behavior — people trust, then verify, then rely.
Software Architecture

