Reference
Query DSL
All analysis goes through a typed Query DSL — a discriminated union on kind. Branches
reference registered metric keys, never raw SQL. There is no SQL surface exposed to
clients, which is exactly what keeps an agent's output safe.
Query types
| kind | question |
|---|---|
trend | how much of X over time (with optional breakdown) |
funnel | what share go from A to B, in order |
retention | do users come back after doing X |
lifecycle | new / returning / resurrecting / dormant under the total |
stickiness | how habitual is the product |
entities | which entities are currently in state S |
Example
query_trend({
metric: "checkout_completed",
date_from: "-30d",
interval: "week",
breakdown: "plan"
})
Right-censoring
Retention and lifecycle are honest about partial windows: recent cohorts expose
mature_periods, and the latest, still-open interval is never counted as churn. Read the most
recent bucket with that in mind.
Dates
Accept relative (-30d, -12w) or ISO. Don't hand-compute timestamps.