A familiar scene: Claude Code confidently suggests a pattern you ripped out half a year ago. Cursor inserts a call to an endpoint that was deprecated long ago. The agent isn’t stupid — it simply has nothing to read except the code and whatever landed in its training data.
Code is not the whole context
We’ve already told the story of how Meldoc was born (How Meldoc came to be): from an attempt to generate documentation from code — and the realization that the most important things can’t be extracted from a repository. Why this solution was chosen and not another. What constraints came from external integrations. What counts as normal behavior and what counts as a bug. All of that lives outside the code: in heads, in threads, in decisions nobody wrote down.
A human who’s missing that context walks over and asks someone. An agent has nobody to ask, so it reconstructs the missing pieces on its own — and delivers the reconstruction in the same confident tone as everything else. That’s what we call a hallucination. Humans catch a version of the same disease, by the way; it just goes by a different name — the false bug (It’s not a bug).
What changes with a knowledge base over MCP
When the agent is connected to the documentation through MCP (MCP in Meldoc), context stops being a prompt problem.
Search returns not whole documents but relevant fragments — and the agent itself controls how much context it needs. Then, in one extra step, it looks at the “knowledge neighborhood” around the found document — similar and related materials — and tops up what’s missing, moving along the connection graph (Graphs in Meldoc).
The glossary teaches the agent your naming: when it reads a document, the project’s terms arrive with it — so it starts using the words your team actually uses, instead of whatever the internet usually calls those things.
And the main thing — it’s a pull model. The agent doesn’t read a pre-compiled retelling that went stale the moment it was compiled. It asks a specific question and gets an answer based on the current state of the knowledge base — at the moment of the request.
In practice: onboarding an agent
Instead of inflating CLAUDE.md into a bedsheet nobody dares touch — connect the agent to the knowledge base. Validation rules, current endpoints, team agreements — it will find them itself, exactly when it needs them.
It works in the other direction too: through MCP the agent doesn’t just read, it writes. You can ask it to find entities that are mentioned in several places but described nowhere — and propose pinpoint edits with a preview (dryRun) that you accept yourself. How that works, step by step — in the article about legacy code (Don’t document legacy. Close the holes).
The takeaway
Hallucinations are a symptom of context deficit. No amount of prompt engineering fixes that — the missing knowledge has to exist somewhere the agent can actually read it, and it has to be current. One honest caveat: an agent connected to stale docs will quote them just as confidently as good ones, so the connection doesn’t replace maintaining the base — it raises the stakes for it. But once the knowledge is there and reachable, the agent finally has material to answer from, and the guessing gets a lot rarer.