# Context engine

> What agents know about your data, and how it stays right: the context you have, edits from your agent, evals built in and the context loop.

What agents know about your data, and how it stays right.

1. **Observe.** Agents use your data.
2. **Diagnose.** Bonnard finds what’s wrong.
3. **Improve.** Your data team answers, into the context.
4. **Verify.** Evals check it helped.

## Bring the context you have

Connect Postgres or your warehouse, and Bonnard reads the tables, keys and joins you already have. Add a dbt or OSI file if you have one.

| Layer | What it holds | Tag |
| --- | --- | --- |
| Your database or warehouse | Tables, keys, comments. Connected read-only. | Start here |
| A dbt or OSI file | Descriptions, keys, joins, metrics. | Optional |
| Your team, through your agent | Definitions, metrics, rules. Your edits win. | Wins |

What your agent reads, for `public.orders`:

| Line | Value | From |
| --- | --- | --- |
| Description | One row per checkout. Test orders are excluded. | Your team |
| Description (replaced) | ~~Orders placed through checkout.~~ | dbt or OSI file |
| Key | id | Database |
| Time column | placed_at | Your team |
| Join | customers on customer_id | Database |
| Join | refunds on order_id | dbt or OSI file |

## Your agent does the work

Define metrics, rules, evals and metadata from the agent that already knows your business. Draft it through the MCP, review it, then publish it.

- You: Add to the orders description that cancelled orders are included.
- `edit_draft`: In the draft, nobody is served it (ok)
- You: Looks right, publish it.
- `publish_draft`: Published version 3 (Live)

An admin decides whether AI clients can publish. Roll back in the console.

### What it can edit

| Type | Example |
| --- | --- |
| Metrics | Net revenue is paid orders, minus refunds. |
| Glossary | A customer is a firm, a client is a person. |
| Rules for every query | No billing data here. Say it’s unavailable, don’t estimate it. |
| Descriptions | One row per checkout. Test orders are excluded. |
| Keys and joins | orders joins customers on customer_id. |
| Searchable values | org_name holds our customers’ names. |
| Hidden tables | Hide orders_old. It stopped updating in May. |
| Eval questions | Add net revenue last month to the golden set. |

## Evals built in

Coming soon.

Run your questions against the live context and any draft, and see what got better, question by question. Then keep running them, so you know your agents are still right.

1. **Pick the questions.** From your verified dashboards, or generated per team.
2. **Run any version.** About 5 answers per question, on live, a draft or a past version.
3. **Compare.** Question by question, scored against your verified dashboard.
4. **Keep running.** Weekly and after each publish, so you see accuracy slip.

| Question | Live | Draft | Result | Why it changed |
| --- | --- | --- | --- | --- |
| What was net revenue last month? | 2 of 5 | 5 of 5 | Better | Net revenue now has one definition |
| What is our average order value? | 3 of 5 | 5 of 5 | Better | Uses the revenue metric |
| What share of orders were refunded? | 4 of 5 | 5 of 5 | No clear difference | Within the run-to-run spread |

## The context loop

Bonnard reads how agents used your data, finds what’s wrong and asks your data team. Their answers go into the context.

### 01 Observe

The activity shows 8 people using 3 definitions.

Inconsistent definitions: net revenue, 3 definitions, 8 people.

| Definition | People |
| --- | --- |
| `sum(total)[status = paid]` | 5 people |
| `sum(total - refunds)[status = paid]` | 2 people |
| `sum(total)` | 1 person |

### 02 Diagnose

Your agent asks what the data can’t settle.

- Agent: People use three definitions of net revenue. The data can’t settle it. Which one is right?
- You: Paid orders, minus refunds.

### 03 Improve

The answer goes into a draft, and a person publishes it.

- `edit_draft`: Net revenue added to the draft (ok)
- Alex Morgan: Published version 4 (Live)
- `net_revenue`: Paid orders, minus refunds.

### 04 Verify (coming soon)

Evals check it helped.

- What was net revenue last month? 2 of 5, then 5 of 5: Better. Net revenue now has one definition.

### It also finds

- Searches that found nothing
- Struggling work
- Errors
- Stale or misleading data

## Start scaling accurate data today

Free for your first 3,000 calls. No seat limits.
