How to build an AI knowledge base from a folder of Markdown files
An AI knowledge base in Markdown is a folder of short, dated .md files, one topic each, plus an index. How to write the files, size them and connect AI tools.

An AI knowledge base built from Markdown is a folder of plain .md files that hold the facts an assistant should be able to look up: one topic per file, a short summary at the top, dates on anything that can change, and an index.md that says what is where. Any model can read the files, any tool can search them, and you can fix a wrong fact by editing one line. The work is not in the format. It is in deciding what goes in, writing each file so it stands on its own, and keeping it current.
This guide covers what belongs in the folder, a file template, a layout, how large the folder can get before a model cannot read all of it, and the four ways to connect it to an AI tool.
What belongs in an AI knowledge base, and what does not?
Put in what is settled and reusable. Leave out what is raw, private or temporary. A knowledge base is a set of answers, not an archive of everything you have written.
| Belongs | Stays out |
|---|---|
| Product facts, prices, specifications | Drafts and brainstorms |
| Decisions, with the date and the reason | Raw meeting transcripts |
| How-to steps that people repeat | Passwords, keys, personal data |
| A glossary of internal names | Two copies of the same fact |
| Policies and their current version | Notes about one finished task |
The second column matters more than the first. A model treats every line it reads as true, so an outdated draft in the folder produces confident wrong answers. Keep drafts in a separate folder that you never hand to the assistant, and move a note into the knowledge base only when it is finished.
How should each file be written?
Write each file so it makes sense with nothing else open. An assistant may read one file out of a hundred, and that file is all it knows.
---
title: Refund policy
summary: Who can get a refund, within how many days, and how to issue one.
updated: 2026-11-20
owner: support
---
# Refund policy
Customers can get a full refund within 30 days of purchase.
After 30 days, refunds are at the support lead's discretion.
## How to issue a refund
1. Open the order in the billing dashboard.
2. Choose Refund and enter the reason.
3. Reply to the customer with the refund confirmation.
## Related
- [Billing FAQ](billing-faq.md)
- [Glossary](../glossary.md)
Source: support handbook, section 4, approved 2026-11-18.
Habits that make files easy to retrieve:
- Answer first. The opening line under the title states the fact. Background comes after.
- Spell out names. Write "the customer billing dashboard" once rather than assuming the model knows what "the dashboard" is.
- Absolute dates. "Last quarter" means nothing in six months. Write
2026-11-20. - One topic per file. "Refund policy" and "Billing FAQ" are two files that link to each other.
- A source line. Say where the fact came from, so you and the model can tell an official rule from a guess.
The summary field is the one that does the most work. An agent deciding which files to open can read just the first lines of each, and a one-sentence summary answers that question for it. YAML front matter for AI covers which fields help and which are noise.
How should the folder be laid out?
Shallow and predictable, with an index at the top. Two levels of folders is enough for most knowledge bases.
knowledge/
index.md
glossary.md
product/
pricing.md
plans-and-limits.md
supported-platforms.md
support/
refund-policy.md
billing-faq.md
decisions/
2026-09-14-move-to-postgres.md
2026-11-02-drop-ie-support.md
index.md lists every file with one line on what it answers. It costs a few hundred tokens and saves an assistant from opening twenty files to find one. Update it in the same edit that adds or renames a file.
File names should describe the content: refund-policy.md, not policy-v2-final.md. Some search tools match file names only and never look inside (the search_files tool of the MCP filesystem server is one), so a clear name is the cheapest retrieval aid there is.
How big can it get before a model cannot read all of it?
Do the arithmetic before choosing a tool. OpenAI's token guide gives the rule of thumb that 100 tokens are about 75 words of English. So:
| Knowledge base | Words | Tokens, roughly |
|---|---|---|
| 40 files of 500 words | 20,000 | 27,000 |
| 200 files of 800 words | 160,000 | 213,000 |
| 1,000 files of 800 words | 800,000 | 1,070,000 |
Anthropic's context window documentation (checked November 2026) lists windows of up to 1M tokens depending on the model, and adds that more context "isn't automatically better", because accuracy and recall degrade as the token count grows. In practice, the first row fits in a single request without thinking about it. The second fits in some models but works better when the assistant reads only the relevant files. The third needs search or retrieval. RAG vs plain Markdown files covers where that line falls.
How do you connect the folder to an AI tool?
There are four common routes, and the folder stays the source in all of them.
| Route | How it works | Good for | Watch out for |
|---|---|---|---|
| Paste or attach | Copy the relevant files into a chat | A few files, one question | Manual every time |
| Project upload | Upload files to a ChatGPT or Claude project | A stable set used across chats | Uploads are copies and go stale |
| Agent in the folder | Run a coding agent such as Claude Code in the folder | Large folders; edits | The agent can change files |
| MCP filesystem server | A chat app reads the folder through a local server | Chat apps on your computer | Setup; scope the path carefully |
Project uploads deserve one warning. When you edit a file in your folder, the copy in the project does not change, so re-upload after edits and keep the date in the file. Project knowledge files for ChatGPT and Claude has the current file limits for each.
How do you keep the knowledge base accurate?
Make staleness easy to find, and give every file a date someone is responsible for.
- Search for old dates.
grep -rl "updated: 2025" knowledge/lists every file nobody has touched this year. - One fact, one place. If the price appears in five files, it will be wrong in four of them eventually. State it once and link to it.
- Delete reversed decisions, or mark them. Keep the old decision file but add a first line that says what replaced it.
- Keep history. Putting the folder in Git means a wrong edit, by you or by an agent, can be seen with
git diffand undone. The commands are in Git for notes. - Ask the assistant to check itself. "List any facts in these files that contradict each other" is a good monthly prompt.
Writing the knowledge base in Noteline
Noteline, which we make, opens the knowledge folder with File > Open Folder… (Cmd+O on a Mac, Ctrl+O on Windows and Linux) and shows its subfolders in the sidebar. Each file stays a plain .md file, so the same folder works with every route in the table above. Find in Folder (Cmd+Shift+F or Ctrl+Shift+F) searches every file, which is also how you find old updated: dates or every mention of a renamed product. When an agent or a sync service changes a file you have open, a bar offers Use disk version or Keep my version. Noteline has no AI features of its own and does not connect to a model. The desktop app has a 14-day free trial, then a one-time license, and the iPhone, iPad and Android apps are free.