andydataguy
AI & SYSTEMS . AI and Data Solutions . 2025

RAG Knowledge Engine

5M-word local corpus wired into agent workflows

Andy Houston author chipBY ANDY HOUSTON
5M-word corpus particle cloud with four task-typed embedding lensesCORPUS 5M WORDSCLUSTERSEMANTICQAQUERYDOC-TYPE CHUNKERS + GEMINI TASK-TYPED EMBEDDINGS
5M
words indexed
4
task-typed embeddings
MCP
exposed
Doc-type
specific chunkers

Context

My own knowledge base and agent workflows: over 5M words across hundreds of mostly Markdown files, plus textbooks in PDF and YouTube content (transcripts and comments). All of it needed to be queryable locally by whatever agents I was experimenting with.

Problem

Vanilla RAG stacks with static chunking and a single generic embedding could not handle the mix. Long essays, structured SOPs, noisy transcripts, and comment threads all got chopped poorly. Retrieval felt random, and nothing integrated cleanly with locally run agent tooling.

Approach

I built on the open-source Archon platform and replaced the default pipelines with document-type-specific ones. For each source (Markdown, PDF, YouTube), I used a cluster-semantic chunker tuned to how I actually write and read. Then I leaned on Google Gemini Embedding 001 task types: cluster for visualizing and organizing the embedding space, semantic for meaning-level similarity, and the dedicated question-answering and document-query task types for retrieval. The whole thing is exposed through a locally run MCP so any agent in my IDE can talk to it as a first-class tool.

Task-typed embedding space (cluster, semantic, QA, query) with retrieval-quality flow.

TASK-TYPED EMBEDDINGS . 4 LENSESCLUSTERSEMANTICQAQUERY

Stack

  • Archon
  • Gemini Embedding 001 (cluster, semantic, QA, query task types)
  • Python stack (Pydantic, FastAPI, Logfire, Hypothesis)
  • Local MCP integration
  • Vector indexing inside Archon

Result

5M words
corpus indexed

Instead of a vague "chat with your docs" toy, I have a targeted retrieval engine that can pull high-signal passages from my own writing, external textbooks, and YouTube data on demand. Agents can now draft, fact-check, and explore ideas using the actual corpus I care about, with far fewer nonsense hops.

5M WORDS · CORPUS INDEXED

Citation-accuracy gauge climbing past baseline RAG performance.

CORPUS INDEXED5M wordsMEASUREDMARKDOWN . PDF . YOUTUBERETRIEVAL ACCURACYUNMEASUREDNO BENCHMARK WAS RUN

Impact

This local engine quietly became the backbone of my content systems and agent experiments. It's the difference between "LLM with vibes" and a serious, evolving knowledge infrastructure I control.

Lessons

Document-type-specific chunking and task-typed embeddings matter as much as the base model. If you treat RAG as an afterthought, everything built on top of it inherits the sloppiness.

Why this matters to you

For teams who want their agents grounded in a deep, private corpus, not just a few PDFs, and who care about owning the full retrieval stack instead of renting a black box.

Sounds like you? Get a quote