Skip to content
Back to Blog

How to Build a Local Knowledge Base Your AI Agents Can Actually Use

AgencyBoxx Team
How to Build a Local Knowledge Base Your AI Agents Can Actually Use

Every agency has the same knowledge problem. The answers exist. Nobody can find them. Building a local knowledge base RAG AI agents can actually query is the infrastructure fix that most teams never invest in.

HubSpot documentation is scattered across hundreds of help articles, developer docs, community forum threads, and academy courses. Client history is buried in email threads and meeting transcripts. Internal SOPs live in Notion pages that were written once and never updated. Onboarding decisions from six months ago are trapped in the head of whoever was on that call.

When a team member needs to know how to configure a specific HubSpot feature, they search the knowledge base, find an article that is sort of relevant, then spend 15 minutes reading through it to figure out if it actually answers their question. When they need context on a client's history, they dig through Slack threads and email archives. When they need to understand why a particular decision was made, they ask the one person who remembers, and hope that person is available.

This is not a training problem. It is an infrastructure problem. The knowledge exists. There is no system that makes it findable, searchable, and usable by both humans and AI agents.

We built that system. It runs locally, costs nothing to query, and is the single most valuable piece of infrastructure in our entire agent stack.

Key takeaway: A local knowledge base RAG system with 33,700+ indexed chunks gives AI agents institutional memory across every client and every process, at zero per-query cost, with full data privacy, and no dependency on external search APIs.

What a Local Knowledge Base Actually Is

The concept is called retrieval augmented generation, or RAG. The idea is simple: instead of asking an AI model to answer a question purely from its training data (which may be outdated, incomplete, or wrong for your specific context), you first search a curated database of documents for relevant information, then hand that information to the model along with the question. The model generates an answer grounded in your actual documentation rather than its general knowledge.

A local RAG system means the entire pipeline runs on your own hardware. The documents are stored locally. The search index is local. The embeddings (the mathematical representations that power semantic search) are generated locally. No data leaves the building. No tokens are consumed for retrieval. No third party service sees your client documentation or internal SOPs.

The AI model only gets involved at the final step, when a human or another agent asks a question and the system needs to synthesize the retrieved documents into a coherent answer. Even then, the model only sees the relevant chunks, not the entire corpus. Context stays tight. Costs stay low.

What We Indexed

Our knowledge base contains 33,700+ indexed chunks drawn from multiple source categories. Each category serves a different purpose in the system:

CollectionSourceChunk CountUpdate Frequency
transcriptsFireflies4,200+Real-time sync
notionNotion2,800+Daily
hubspot_kbHubSpot Knowledge Base8,500+Weekly (Sun-Fri)
hubspot_apiHubSpot API Docs3,100+Weekly (Wednesday)
hubspot_communityHubSpot Community5,400+Twice weekly (Sun/Wed)
gdriveGoogle Drive1,900+Daily
hubspot_partnersHubSpot CRM2,200+Weekly
muse_content_libraryContent Pipeline1,600+On publish
front_emails (per client)Front Inboxes3,900+Continuous

HubSpot documentation. The full knowledge base, API documentation, and community forums. This gives our agents (and our team) instant access to how HubSpot works without needing to search the web, consume cloud API tokens, or rely on a model's potentially outdated training data. When an agent needs to understand how a specific API endpoint works or how a feature behaves, it queries the local index and gets an answer in milliseconds.

Client specific knowledge. Email history, meeting transcripts, project notes, and communication records, all tagged with the client code and stored in isolated namespaces. When an agent drafts a reply for a specific client, it retrieves context only from that client's namespace. Cross client content is never mixed. This is not just a convenience feature. It is a data isolation requirement that is non negotiable for white label operations. The email safety architecture depends on this isolation at the database level.

Internal agency knowledge. SOPs, process documentation, team guidelines, and operational playbooks. This is the institutional memory that normally lives in one person's head or in a Notion workspace that nobody navigates. Indexed and searchable, it becomes available to every agent and every team member through plain English queries.

Meeting intelligence. Transcripts from client calls and internal meetings, processed and chunked so that specific decisions, commitments, and action items are retrievable. When an agent prepares a pre meeting briefing or a follow up summary, it pulls from the actual conversation history rather than relying on someone's notes.

These four categories map to three separate database tiers with enforced access boundaries: public knowledge (HubSpot docs, general best practices), internal knowledge (agency SOPs, team docs), and client specific knowledge (emails, transcripts, project history). The separation is enforced at the database level, not through prompt instructions. An agent querying client facing context physically cannot retrieve internal agency documentation, because the query never hits that database.

How Indexing Works (Without Giving Away the Whole Pipeline)

The high level process for getting a document source into the knowledge base:

Step 1: Acquisition. Get the raw content. For web based sources like HubSpot's knowledge base and community forums, this means scraping. For internal sources like Notion or Google Drive, this means API based extraction. For email and meeting transcripts, this means pulling from Gmail and your transcription service. Each source has its own acquisition method, but the output is the same: raw text with metadata (source URL, date, client code if applicable).

Step 2: Cleaning. Raw content is noisy. Web pages have headers, footers, navigation menus, sidebars, and boilerplate HTML. Meeting transcripts have filler words, false starts, and off topic tangents. Email threads have signature blocks, disclaimers, and forwarded chains. The cleaning step strips all of that down to the useful content. For web sources, we use a local model via Ollama to extract the signal: what is the problem being discussed, what is the solution, and what context matters. This costs zero in API fees because the model runs locally.

Step 3: Chunking. Clean documents get broken into chunks of a size that is useful for retrieval. Too large, and the chunks contain irrelevant information that dilutes the answer. Too small, and the chunks lose context. The optimal chunk size depends on the source type. HubSpot documentation chunks differently than meeting transcripts, which chunk differently than email threads.

Step 4: Embedding. Each chunk gets converted into a vector embedding, a mathematical representation that captures the semantic meaning of the text. We use nomic embed text running locally via Ollama. This model handles all of our embedding generation at zero marginal cost. The embeddings are stored in ChromaDB, a vector database that also runs locally.

Step 5: Indexing. The embedded chunks, along with their metadata (source, date, client code, collection name), are stored in the vector database and become queryable. Semantic search finds chunks based on meaning rather than keyword matching. Text based search handles proper nouns, client codes, and specific terms that semantic search sometimes misses. Both search modes run against the same index.

The entire pipeline for a new source takes about a night to run. HubSpot's knowledge base, API docs, and community forums took roughly one night each. The processing is not fast, but it is unattended and free. You start it before bed and wake up to a fully indexed source.

Why Local Changes the Economics

The cost difference between a local RAG system and a cloud based one is not marginal. It is structural.

"Approximately 60% of Google searches now end without a click to any website, making institutional knowledge retrieval increasingly critical." -- Google Search Analysis

That statistic underscores why owning your own knowledge infrastructure matters: relying on web searches to answer operational questions means competing with a discovery environment where the majority of queries never reach the source material. A local knowledge base eliminates that dependency entirely.

Consider what happens every time an agent needs context. In a cloud based system, the agent sends a query to an embedding API (cost: tokens), receives results from a hosted vector database (cost: per query or subscription), and then sends the retrieved context plus the question to a cloud model (cost: tokens for the full context window). Every query costs money. Every re index costs money. Every new document added to the corpus costs money to embed.

In our local system, the agent embeds the query locally (cost: zero), searches the local vector database (cost: zero), and retrieves matching chunks (cost: zero). The only cost is when the agent sends the retrieved chunks to a cloud model for synthesis, and even then, the context has already been narrowed to just the relevant chunks rather than the full corpus.

Our agents query the knowledge base dozens of times a day across multiple agents and multiple clients. If each query cost even a fraction of a cent in cloud API fees, the monthly bill would be significant at our volume. Running locally, the marginal cost of queries is zero regardless of volume.

Re indexing is where the savings compound most aggressively. When we want to experiment with a different chunking strategy, re embed with a newer local model, or refresh a source with updated content, we re run the pipeline at no cost. On cloud infrastructure, every re index means re embedding every chunk, which means paying for every token again. This creates a perverse incentive to not update your knowledge base because updates cost money. Locally, updates are free, so we update aggressively. Weekly automated syncs keep knowledge current without manual intervention and without a bill.

Over 12 months, with 33,700+ chunks and growing, the cumulative savings from local embeddings, local search, and free re indexing add up to thousands of dollars compared to equivalent cloud services. And the system gets more valuable over time as we add more sources, not more expensive.

What the Knowledge Base Enables

A searchable knowledge base is useful on its own. Team members can ask questions in a Slack channel and get sourced answers with attribution. That alone saves 2 to 4 hours per week in "where is that documentation" and "how does this HubSpot feature work" conversations.

But the real value is what the knowledge base enables for every other agent in the system. According to HUMAN Security via Search Engine Land, AI scraper traffic grew nearly 600% in 2025, accelerating the shift toward AI-mediated discovery. Agencies that control their own knowledge layer are positioned to serve clients in a world where AI intermediaries, not search engines, increasingly determine what information gets surfaced.

The Executive Assistant queries client history when drafting email replies. Instead of generating a response from general knowledge, it grounds the draft in actual previous communications with that specific client.

The Client Experience Monitor uses the knowledge base to generate context aware SLA drafts. When a client email has gone unanswered for four hours and the system generates a holding reply, it pulls relevant project context so the draft references the actual work being done, not a generic "we are looking into this."

The BDR agent queries HubSpot documentation when preparing pre meeting intelligence briefings, so the sales rep walks into the call understanding the prospect's likely tech stack and pain points based on their HubSpot tier and partner status.

The Delivery agent references SOPs and project documentation when generating compliance reports, ensuring that budget alerts and time tracking summaries reflect the actual agreed upon processes for each client.

The Critical Alert System uses knowledge base context to enrich alerts. When an upset client is detected in a meeting transcript, the alert includes relevant history: previous escalations, project status, and recent communication, so the person responding has full context without needing to research it.

"The best AI implementations do not replace human expertise. They make it findable, reusable, and available at the moment of need." -- McKinsey Digital

Every agent gets smarter because it has access to institutional knowledge. Every document added to the knowledge base improves every agent that queries it. This is the compounding effect that makes the knowledge base the highest leverage investment in the entire system. ChatGPT traffic converted 31% higher than non-branded organic search, according to HubSpot's research, which suggests that AI-grounded answers (the kind a RAG system produces) carry more trust and conversion weight than generic search results.

Knowledge Gap Detection: The Hidden Feedback Loop

One of the most unexpected benefits of the knowledge base has been what it reveals about gaps in our documentation.

The system monitors Slack for questions that go unanswered for six or more hours. When the knowledge base cannot answer a question, that is a signal. It means there is a gap in the documentation. Either the SOP does not exist, or it exists but was not written clearly enough to be retrievable, or the topic was never documented in the first place.

Over months of operation, these gaps form a map of exactly where institutional knowledge is missing. Instead of guessing which SOPs need to be written or updated, the system tells you based on what the team is actually asking and not finding.

This turns the knowledge base from a static repository into an active feedback loop. The team asks questions. The system answers what it can. The gaps reveal what needs to be documented. The new documentation gets indexed. The system gets smarter. The gaps shrink. Repeat.

No amount of "documentation sprints" or "let us update our Notion this quarter" initiatives will produce the same result. The knowledge base tells you exactly what is missing based on real demand, not someone's guess about what the team might need.

Getting Started

If you are thinking about building a local knowledge base for your agency, here is the minimum viable version:

Hardware: Any Mac with Apple Silicon (M1 or later) or a Linux machine with a decent GPU. You need enough RAM to run a local embedding model. 16GB is workable. 32GB or more is comfortable.

Software: Ollama for running local models. ChromaDB (or any vector database that runs locally) for storage and retrieval. A local embedding model like nomic embed text. Python for the acquisition and processing scripts.

First source to index: HubSpot's knowledge base. It is publicly accessible, well structured, and immediately useful. Your agents and your team will query it daily. The scraping, cleaning, and indexing pipeline for a single web source can be built in a day and run overnight.

Second source: Your internal SOPs and process documentation from wherever they currently live (Notion, Google Drive, Confluence). This is the knowledge that is currently trapped and inaccessible. Getting it indexed and searchable transforms how your team operates.

Third source: Client email history and meeting transcripts, indexed with client codes for namespace isolation. This is what makes your agents context aware instead of generic.

You do not need all 33,700+ chunks on day one. Start with one source. Get the pipeline working. Prove the value with your team. Then expand. Each new source makes the system more useful, and the indexing cost is zero because everything runs locally. To understand how the knowledge base fits into a script first agent architecture, and which agents to build first, those foundations matter. The security model explains how client data stays isolated across every layer.

Investing in a local knowledge base that RAG-powered AI agents query continuously took us the longest to build and has delivered the highest return of any infrastructure investment in the system. Every agent is better because it exists. Every team member is faster because they can query it. And every new document we add makes the whole system smarter without costing a cent.

Frequently Asked Questions

What is a local knowledge base for AI agents?

A local knowledge base is a retrieval augmented generation (RAG) system that runs entirely on your own hardware. Documents from sources like HubSpot documentation, client emails, meeting transcripts, and internal SOPs are cleaned, chunked, and embedded into a vector database. When an AI agent needs context, it queries this local database instead of searching the web or relying on the model's training data. The entire retrieval pipeline (embedding the query, searching the index, returning matching chunks) runs at zero cost because nothing leaves your machine. The AI model only gets involved at the synthesis step, when the retrieved chunks need to be turned into a coherent answer.

How many documents can a RAG system index?

There is no practical upper limit for a well designed local RAG system. Our production system currently holds 33,700+ indexed chunks across 17+ collections, spanning HubSpot documentation, API docs, community forums, client email history, meeting transcripts, and internal SOPs. The limiting factor is storage space and indexing time, not any architectural ceiling. A single source like HubSpot's knowledge base can be scraped, cleaned, chunked, and indexed overnight. Adding new sources scales linearly: each new collection is independent, and weekly automated syncs keep everything current without manual intervention.

Does a local knowledge base replace Google Docs or Notion?

No. A local knowledge base is a retrieval layer, not a creation or editing tool. Your team continues to write SOPs in Notion, store documents in Google Drive, and manage projects in ClickUp. The knowledge base indexes those sources and makes them searchable by both humans and AI agents through semantic queries. The value is not replacing where knowledge lives. It is making knowledge findable regardless of where it lives. A question asked in Slack can pull answers from Notion pages, Google Drive documents, HubSpot articles, and meeting transcripts simultaneously, because all of those sources have been indexed into a single searchable layer.

How do AI agents use institutional knowledge?

Each agent queries the knowledge base for context relevant to its specific task. The executive assistant pulls client communication history when drafting email replies. The client experience monitor retrieves project details when generating SLA holding responses. The BDR agent looks up HubSpot documentation when preparing meeting briefings. The operations agent references SOPs when generating compliance reports. The knowledge base acts as shared memory across all agents, grounding their output in your actual documentation rather than generic model training data. Namespace isolation ensures each agent only retrieves content appropriate to its role and the client it is serving.

AgencyBoxx ships with a full RAG knowledge base: 33,700+ indexed chunks across HubSpot documentation, client history, meeting transcripts, and agency SOPs. All local. All searchable. Zero per query cost. Book a Walkthrough to see it in action.