# A knowledge factory for your data

> A knowledge factory keeps what agents need to know current. Here is what one looks like for your data, and how far Bonnard has built it.

[Image: How Bonnard keeps context current, in two rows. The asking: your people and your customers ask through their agents, over MCP. The agent reads the context first: data access guidance (tables, keys, joins), domain knowledge (metrics, terms) and skills (verified questions, in development). Then it queries your sources, read-only. The data work: Bonnard keeps every call in the activity record: calls, searches and definitions. Your data team's own AI reads the record to find the gaps, and updates the context. Your dbt project sits between the data team and the sources it builds. Two more lines are in development: the project is imported into the context, and a fix to the data itself goes to the project as a pull request, which is merged and built.]

Agents fail at company work when they don't know how the company runs. So you need a system that collects that knowledge and keeps it current for them. People have been working on this for a while. LangChain recently gave it a good name: a [knowledge factory](https://www.langchain.com/blog/knowledge-factory).

Our vision for Bonnard is similar, and the path is evolving fast. This post shows what it looks like for data and how far along we are.

## Three kinds of knowledge

LangChain's post names three kinds of knowledge an agent needs:

[Image: Three kinds of knowledge an agent needs. Skills: how to do the work the way your company does it. Domain knowledge: how the business works, its products, customers and policies. Data access guidance: which source to use, what lives where and how to query it.]

On data, the post makes a point we would underline. If your warehouse is the source of truth, don't keep a second copy of the data for agents. Keep instructions on what lives where and how to query it.

All three apply to data work. We started with the third.

## Data access guidance comes first

Data is the ground truth, and getting it right is the hygiene work. In Bonnard that work is called context, and it is three things:

- **Data access guidance.** Tables, keys and joins: what each table and column holds, and how they connect.
- **Domain knowledge.** Metrics and terms: a calculation with instructions on when to use it, and what a word means in your data.
- **Skills.** Verified questions: a real question with the SQL that answers it. In development.

It is kept per data source, and agents read it through one MCP before they write SQL. The MCP runs that SQL on your database, read-only.

It pays off early. In [our own agent testing](/blog/warehouse-as-semantic-layer), authored descriptions on an opaque schema took an agent's first-try table-finding from roughly one in four to near-perfect.

Your agents already hold a lot of the context. Bonnard gives you and your agent the tools to update it straight from where you work. A system that keeps improving is what comes next.

## The system that keeps improving

Context goes stale. Tables change, a metric gets a new rule, and people ask questions nobody wrote a definition for. The fix is a loop that runs on real use: agents use your data, the gaps are found, your data team answers into the context, and a check confirms the change helped.

[Image: The context loop in four steps: observe, diagnose, improve, verify.]

It starts with an event log. The activity record tracks every call an AI client makes through Bonnard: on your data sources and on the context itself. Each call is one row: who called, which tool, why, the SQL and how it ended.

[Image: The activity record as an event log. Five tool calls from two people: schema searches and queries from ChatGPT and Claude, one failing with an undefined column and one search that found nothing. One row is opened: a query by Sam Patel from ChatGPT on the sales data source, with its intent, its SQL for net revenue by region, four rows returned and found nothing false.]

Every gap shows up there as rows. A query that failed, a search that found nothing, a metric three agents calculated three ways. Your data team reads the record with their own AI, and the fix goes into the context every agent reads next.

Parts of the loop still need a person to start them. Here is where each step stands.

Table: What works today, and what is in development

| Step | Today | In development |
|---|---|---|
| Record | Bonnard keeps every call, with its intent, its SQL and how it ended. | A tool for agents to flag what was missing or wrong. |
| Gaps | Your data team's own AI reads the record and finds them. | A ranked list of gaps, ready when they open it. |
| Update | Their AI drafts the change to the context. A person publishes it, and any version can be rolled back. | Verified questions that run before a publish goes through. |
| Data fix | A gap in the data is reported to your data team. | A pull request on your dbt project. |

## How we are getting there

### A person publishes

The curator stops at a draft. A definition is ground truth for every agent that reads it, so a person who knows the business reads the change first. A flag from an agent is treated the same way. It can point a person at a problem, and it never writes to the context on its own.

### Rules find the gaps, the model drafts

A failed query, a search that matched nothing and a session that took nine calls are all countable. You don't need a model to find them, and a rule gives the same list every time. The model does the part that needs judgement: working out what the agent was trying to do, and drafting the fix.

### Your own assistant curates first

The curating is done by your data team's own AI client, such as Claude or ChatGPT, with their permissions, on the subscription they already pay for. A curator that runs in the background comes once the gaps outrun what a person can review.

## One loop, end to end

Here is one change going round the loop.

[Image: One change moving through the loop. Eight people ask, and their agents write three calculations of net revenue. Every call goes into Bonnard's activity record, kept with its SQL. The gaps go to the data lead, whose AI checks the data and asks about refunds. The update goes into Bonnard's context: one metric, and agents stop deriving their own.]

Someone in finance asks their agent for net revenue by region. The agent searches the schema, finds the orders table, writes SQL and gets a number. Over a month, eight people ask a version of that question, and their agents write three different calculations. Each call is in the activity record with its SQL.

[Image: Bonnard's activity record over 30 days. It finds three definitions of net revenue across eight people, a search for gift cards that found nothing, sessions that took nine calls, an undefined column error and a table that stopped in May.]

The data lead asks their own Claude what to fix on that data source. It reads the record, groups the three calculations and checks each one against the data. Then it asks the one thing the data cannot settle: do refunds come out of net revenue.

The lead answers. The assistant drafts a metric with its calculation and an instruction for agents. The lead reads the draft and publishes it. The next agent that is asked for net revenue gets the metric and stops deriving its own.

## Skills and domain knowledge

The same loop will keep these current.

- **Domain knowledge.** Metrics and terms are the first of it: a calculation or a word, with what it means in your data.
- **Skills.** Verified questions are the first of them. They also catch what the activity record cannot: a query that ran and returned the wrong number. They are in development.

## What comes next

### Improvements to your dbt project

Some gaps are not context gaps. If people keep asking for a column that no model has, a better description does not help. The fix belongs in your dbt project.

We are building that in two parts:

- **Import.** Bonnard reads your dbt project, so the context starts from the models and descriptions you already have. It arrives one of two ways: you connect dbt Cloud, or you add a step to your CI/CD that sends the project on each change.
- **Pull requests.** When the activity record shows a gap in the modelling, the curator drafts the change and raises it as a pull request on GitHub. Your team reviews it there, like any other change.

[Image: How a dbt project fits in. Your dbt project builds your sources, as it does today. Bonnard reads the sources, read-only, and holds the context and the activity record. Your data team finds the gaps in the record. Two lines close the loop, both in development. Over the top, the project's own descriptions and metrics are imported into the context, from dbt Cloud or your CI/CD. Along the bottom, a gap in the data goes back to the project as a pull request on GitHub: your team merges it, and the next build carries it into your sources.]

### Suggestions without asking

Today the data lead has to ask their assistant what to fix. We want the loop to run on a schedule and leave a list of suggestions, each with the calls behind it, for a person to accept or reject.

### Automated insights

The same setup can do more than fix context. An agent that runs on a schedule, with a prompt you wrote and the context it already has, can tell you when a metric moves. You decide what it looks for. We have not built this yet.

[Image: Automated insights, not built yet. You say which metric to watch and when to be told. An agent runs on a schedule you set. Over MCP, it reads Bonnard's context and then your sources. You hear back only when the metric moved.]

## Get the data right first

You don't have to document everything first. As LangChain's post puts it, "doing the work reveals what knowledge is missing". Connect one database, let people ask their questions, and read the activity record after a week.