Guide · Metric glossary

Metric definitions agents can query: a business glossary template

For analytics engineers and data leads who want agents to stop reinventing metrics.

Updated

A business glossary agents can query defines each metric once: its name, what it measures, the entity it is counted at (the grain), how it is calculated, its default time field and groupings, and its unit. The Brain stores each as a metric record, so an agent asks for "Net revenue" and gets one definition instead of inventing a calculation.

  • One definition per metric: name, description, grain entity, kind, expression, unit.
  • Metrics come from dbt artifacts (including MetricFlow), from mined SQL, or are curated by hand.
  • Metrics are definitions agents read; the built-in compiler covers single-grain aggregations and other metrics point at the upstream engine.

Define each metric once

Write the definition where your team already works, then let the Brain hold it. For each metric record the name, what it measures, the grain entity, how it is calculated, the default time field and groupings, and the unit. Keep terms and rules separate: a term says what a word means, a rule says what must hold.

## Net revenue

Sum of order totals in dollars for orders with status shipped,
excluding refunded orders. Counted per Order. Default time field:
placed_at. Usually grouped by region. Unit: USD.

Bring definitions in

If you already model metrics in dbt, upload the dbt artifacts (the manifest, plus the catalog and semantic manifest if you have them) so the metrics defined there arrive as metric records. Otherwise put definitions in markdown and sync the folder, then review what ingestion proposes before it merges.

npx -y @brainbox-labs/cli@latest meta ingest dbt --artifacts ./target
npx -y @brainbox-labs/cli@latest sync ./glossary --namespace glossary

How an agent reads a metric

The agent calls recall_domain with kind set to metric. With a name it gets that metric, and without one it lists them. The result carries the grain entity, unit, kind and origin. The built-in compiler covers single-grain aggregations; for anything more complex the metric points at the upstream engine instead of re-deriving the calculation.

{ "kind": "metric", "name": "Net revenue" }
Fields of a metric definition
FieldWhat it holds
name, descriptionThe business name and what it measures
grain entityThe entity each row is counted at, such as Order or Subscription
kindsum, count, count_distinct, avg, min, max, ratio or custom
expressionA SQL aggregate (select and optional where), a ratio of two metrics, or a reference to a dbt or Cube metric
default time field and group-bysThe usual time bucket and groupings, as fields on the grain entity
unit, formatUnits, and display as currency, number, percent or duration
origindbt, cube, metricflow, sql_query_mined or curated

FAQ

What is a metric in the Brain?
A named business measure such as MRR or churn rate: description, grain entity, kind, an expression, default time field and group-bys, unit and format.
Where do metric definitions come from?
Each metric records its origin: dbt, cube, metricflow, sql_query_mined or curated. You can import dbt artifacts or write definitions in docs and review them.
How is a metric different from a rule?
A metric says how a number is calculated. A rule is a business constraint or policy, with conditions, such as a refund window.
How does an agent read a metric?
Over MCP with recall_domain and kind "metric", with or without a name. get_index lists the metric names.

Give your agents a brain.

Sign in and ask your first question.

Book a Demo