Skip to content

Overview — Project 2: AskDocs

Project 1 converted one frozen page into one artifact. Project 2 builds AskDocs, a CLI that answers questions from a directory of Markdown and text files. You will build the small honest version of RAG: chunk, embed, retrieve, assemble context, generate, and cite.

Terminal window
cd rust
cargo run -p askr -- --mock --rag askr/sample-docs \
"What does Rust use instead of a garbage collector?"

The reference crate uses a deterministic hashing embedder and mock language model when no key is available. The output is not supposed to be intelligent; it proves which chunks were selected and what context crossed into the model boundary.

DayBuildRust learned by needing itAI system learned by observing it
6directory ingestion and chunksiterators, strings, paths, ownershipchunking changes retrievability
7offline embeddings and top-ktraits, slices, floats, lifetimessimilarity is a ranking signal
8grounded prompt and citationsborrowed results, formatting, errorsretrieval is not proof of support
9streaming plus frozen questionsasync, callbacks, byte buffers, testsUX and quality need separate measures
docs ─▶ chunks ─▶ embeddings ─▶ vector store
question ─▶ query embedding ─▶ top-k ─▶ context manifest ─▶ model ─▶ cited answer

The companion has two levels:

  • rust/askr is the small project you can understand end to end;
  • rust/rust-ai-engineering contains the hardened retrieval, evidence, snapshot, and provider contracts that later projects reuse.

Do not start with a vector database. First make ranking visible with a Vec, cosine similarity, three documents, and assertions you can calculate by hand.

Start with Day 6 — Ingest and Chunk →.