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.
Run the finished first slice
Section titled “Run the finished first slice”cd rustcargo 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.
The four days
Section titled “The four days”| Day | Build | Rust learned by needing it | AI system learned by observing it |
|---|---|---|---|
| 6 | directory ingestion and chunks | iterators, strings, paths, ownership | chunking changes retrievability |
| 7 | offline embeddings and top-k | traits, slices, floats, lifetimes | similarity is a ranking signal |
| 8 | grounded prompt and citations | borrowed results, formatting, errors | retrieval is not proof of support |
| 9 | streaming plus frozen questions | async, callbacks, byte buffers, tests | UX and quality need separate measures |
Product pipeline
Section titled “Product pipeline”docs ─▶ chunks ─▶ embeddings ─▶ vector store │question ─▶ query embedding ─▶ top-k ─▶ context manifest ─▶ model ─▶ cited answerThe companion has two levels:
rust/askris the small project you can understand end to end;rust/rust-ai-engineeringcontains 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 →.