a fully-local rag assistant over 125+ works of marx, engels and lenin. every answer resolves to the passage it came from.
the question is condensed with the chat history so follow-ups keep their subject. retrieval runs twice at once, vector search over chroma and bm25 keyword search, fused by reciprocal rank. an optional local cross-encoder re-scores the candidates before qwen3.5:9b reads them and writes the answer in streamlit.
the corpus, the embeddings, the re-ranker and the model all live on the machine. nothing is sent to a third party.
answers carry markers like [1] or [2, 4] that render as superscript links to a footnote with author, work, year, section and a link back to marxists internet archive. a marker that does not map to a retrieved passage is dropped and reported instead of being rendered as a dead link.
an answer without a source is a rumour with better grammar.
if the model reports that the passages are insufficient, the app widens retrieval once — more passages, a larger candidate pool, no similarity floor — and retries. if the second pass still fails, it says so instead of guessing.
25 curated questions drive the evaluation harness. hit@k asks whether the right work appeared at all; mrr@k asks how high it ranked. on this corpus hybrid retrieval lifts hit@6 from about 48% to 68%, and the re-ranker lifts mrr from 0.49 to 0.62.
a second mode runs the full retrieve-cite-answer pipeline against a judge model and reports faithfulness, answer relevancy, citation validity and retry rate.