# How do you build a personal knowledge base an agent can use?

Date: 2026-08-03 · Author: Robert Scales · https://guidetoartificialintelligence.com/en/learn/build-personal-knowledge-base-agent-use/

**Answer:** Keep your notes as plain text files in a small set of clearly named folders, add an index file that tells the agent what is where and how to behave, and give the agent access only to that folder through a tool such as an MCP filesystem server. The agent then opens the few files it needs for each question instead of reading everything.

A **personal knowledge base** is your own collection of notes, references and records, organized so you can find things again. An **agent**, in Anthropic's simple definition, is a language model using tools in a loop: it can list folders, open files, search and write. Put the two together and you can ask "What did I decide about the garden fence last spring?" and get an answer drawn from your own notes, with the file it came from.

You do not need a database or special software for this. Plain text files in well-named folders work very well, because agents already know how to move around a file system. Anthropic describes this as a **just-in-time** approach: rather than loading everything up front, the agent keeps lightweight references such as file paths and opens only what the current question needs. Folder names, file names and dates all act as clues about what a file is for.

## A worked folder layout

Here is a layout for one person's notes. Each file is Markdown, plain text with light formatting, so both you and the agent can read it.

```text
kb/
  INDEX.md              <- read first: map of the folders and the rules
  projects/
    2026-garden-fence.md
    2026-kitchen-renovation.md
  people/
    contractors.md      <- names, trades, what they quoted, no personal IDs
  reference/
    car-maintenance.md
    recipes-tested.md
  journal/
    2026-07.md          <- one file per month, dated entries
  inbox/                <- the only folder the agent may write to
```

Three habits make it work. Start every file name with a date or a clear subject, so a listing tells the story. Begin every file with two or three lines saying what it contains and when it was last updated. And keep one topic per file, so the agent opens a short, relevant file instead of a long mixed one.

## The index file

The index is the agent's map. Coding agents already work this way: Claude Code automatically loads a file called CLAUDE.md into its context at the start, and Anthropic suggests putting rules and instructions there. Whatever agent you use, you can ask it to read INDEX.md first.

```prompt
# INDEX.md — read this before answering any question

## What is where
- projects/ : one file per home or work project, named YYYY-topic.md
- people/ : contractors and services, with what they did and quoted
- reference/ : stable how-to notes (car, recipes, appliances)
- journal/ : monthly diary files, dated entries

## How to answer
- Search file names first, then open at most 5 files.
- Quote the file name for every fact you use.
- If the notes don't say, answer "not in my notes". Never fill gaps from general knowledge without saying so.

## Writing rules
- Write only to inbox/. Never edit or delete other files.
- Name new files YYYY-MM-DD-topic.md.
```

## Connecting the agent to the folder

The Model Context Protocol (MCP) is an open standard for connecting AI apps to tools and data. Its reference **filesystem server** lets an assistant such as Claude Desktop read, write, list, move and search files, and it only allows operations inside the folders you pass to it when it starts. A configuration entry looks like this:

```json
{
  "mcpServers": {
    "notes": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/kb"]
    }
  }
}
```

The server's write tool can create new files or overwrite existing ones, and its documentation advises care with it. That is why the index limits writing to `inbox/`, and why the folder should be backed up or kept under version control, so any unwanted change can be undone. Anthropic's coding agent also asks for permission before actions that change things, unless you turn that off; leave it on for your notes.

> **Try it:** Create the `kb/` folder with five real notes and an INDEX.md, connect it, and ask three questions whose answers you know. Check that every answer names a file, and that one question with no answer in your notes gets "not in my notes."

## How do you keep private notes private?

Use the folder boundary, not instructions. A line in INDEX.md saying "don't read the medical folder" is a request the model may or may not follow. A folder that was never passed to the filesystem server is out of reach, because the server refuses operations outside the folders it was given. So keep a separate folder, such as `kb-private/`, outside `kb/`, and never add it to the agent's configuration.

Remember where the text goes. Every file the agent opens is sent to the AI model as part of the conversation, which usually means to the provider's servers. Check your provider's data settings, and leave anything you would not share with that company out of the shared folder: passwords, account and ID numbers, health details, other people's private information.

Treat outside documents with care too. A web page or email saved into your notes can contain hidden instructions aimed at the agent, a risk known as prompt injection. Anthropic warns that letting an agent act without permission checks invites data loss and prompt injection problems, so keep confirmations on, keep the agent's write access to one folder, and review what lands in `inbox/` before moving it into your knowledge base.

## Sources

- Filesystem MCP Server README: https://github.com/modelcontextprotocol/servers/blob/a54651477cf8849ba800336856f4f700bfef0e02/src/filesystem/README.md
- Effective context engineering for AI agents: https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents
- Claude Code: Best practices for agentic coding: https://www.anthropic.com/engineering/claude-code-best-practices
