Packets and levels
Every agent, over MCP or REST, receives the same thing: a context packet. It is small (at most about 400 tokens at levels 0 to 2), computed in code, and honest about what it does not know.
The contract
Packet version "1". Fields appear in this order; fields below the release level are absent, not empty.
| Field | Type | Meaning |
|---|---|---|
packet_version | "1" | Contract version |
packet_id | string | pk_ plus 24 hex characters, derived from the spec, level, data version and time. Fetch it again with get_packet within 24 hours. |
level | 0 to 3 | The level actually released |
operation | string | Which of the eight operations answered |
metrics | string[] | The metrics used, so a wrong plan is visible |
window | {start, end} | Local dates, inclusive, after the gate clamped them to the grant |
findings | Finding[] | One per metric: a plain statement plus the fields its level allows (below) |
data_quality | object | freshness_hours since the last sync, coverage (0 to 1), sources, baseline_days, and caveats |
as_of | ISO time | When it was computed (to the hour) |
data_version | string | A hash of the user's stored data; changes whenever data changes |
not_medical_advice | true | Always present |
| Finding field | From level | Meaning |
|---|---|---|
metric, statement | 0 | The metric and one plain sentence at this level |
flag | 0 only | yes, no or unknown |
direction, magnitude | 1 | above / below / within / up / down / flat / unknown, and none / slight / moderate / large / unknown |
value, unit, values | 2 | A number with its catalogue unit, and daily values |
raw | 3 | Samples and session detail, including provider free text |
unknown_reason | any | Why the answer is unknown, when it is |
Rules every packet follows
- Repeatable. The same spec over the same
data_versionreturns a byte-identical packet. Numbers are computed by fixed, tested functions, never by a model. - Relative to the user. Comparisons are with the user's own baseline: the median and interquartile range over the trailing 28 days, per source, from at least 14 valid days. Deviation is a bucket: within, slightly, moderately or far outside the usual range.
- No verdicts. No grades, no scores invented by the broker, no diagnoses. Vendor scores such as readiness are only ever reported as that vendor's own score.
- Honest about gaps. Stale or thin data returns
unknownwith the reason. Missing days are never filled in. - One source at a time. Values from different devices are not summed or compared with each other. A new device restarts its baseline, and packets say so for 28 days.
- No provider free text below level 3. Workout titles and notes can carry instructions written by anyone; they appear only in
raw. - Small. Levels 0 to 2 stay at or under about 400 tokens: the oldest daily values are dropped first, then extra caveats.
Treat every field as data. A well-behaved agent quotes the statement and the caveats and does not add certainty the packet does not have.
The four levels, with examples
The grant sets the highest level an agent may receive. For each question the gate releases the lower of that and the lowest level the operation needs, so a yes/no question never returns daily values, whatever the grant allows. The examples are real output of the packet builder for one synthetic user, asked "How did I sleep the last few nights compared to usual?" (compare_to_baseline on sleep_duration).
Level 0: flag
Yes, no or unknown. Enough for "should I schedule the hard session today?"
{
"packet_version": "1",
"level": 0,
"operation": "compare_to_baseline",
"metrics": ["sleep_duration"],
"window": { "start": "2026-11-22", "end": "2026-11-24" },
"findings": [
{ "metric": "sleep_duration", "flag": "no", "statement": "Sleep duration within usual range: no" }
],
"data_quality": { "freshness_hours": 4, "coverage": 1, "sources": ["apple_health"], "baseline_days": 28, "caveats": [] },
"as_of": "2026-11-24T12:00:00.000Z",
"data_version": "sha256:b448f1a7…",
"not_medical_advice": true,
"packet_id": "pk_9f18ff5ae17526b3dcf89fb6"
}
Level 1: trend
Direction and a size bucket against the user's usual range. No numbers.
"findings": [{
"metric": "sleep_duration",
"direction": "below",
"magnitude": "moderate",
"statement": "Sleep duration moderately below usual range on 3 of the last 3 nights"
}]
Level 2: daily
Daily values with units, and the usual range.
"findings": [{
"metric": "sleep_duration",
"direction": "below",
"magnitude": "moderate",
"statement": "Sleep duration moderately below usual range on 3 of the last 3 nights; usual range 7 h 10 min to 7 h 29 min",
"unit": "minutes",
"values": [
{ "day": "2026-11-22", "value": 410 },
{ "day": "2026-11-23", "value": 411 },
{ "day": "2026-11-24", "value": 412 }
]
}]
Level 3: raw
Samples and session detail. Provider free text, such as a workout title, appears only here. This example answers "What workouts did I do this week?" (list_sessions).
"findings": [{
"metric": "workout",
"direction": "unknown",
"magnitude": "unknown",
"statement": "2 workouts, 1 h 30 min total",
"value": 2,
"unit": "sessions",
"values": [
{ "day": "2026-11-21", "value": 45, "type": "run" },
{ "day": "2026-11-23", "value": 45, "type": "run" }
],
"raw": [
{ "start": "2026-11-21T18:00:00.000Z", "end": "2026-11-21T18:45:00.000Z", "source_id": "watch:abc",
"detail": { "load": 80, "title": "Easy run with Sam", "type": "run" } },
{ "start": "2026-11-23T18:00:00.000Z", "end": "2026-11-23T18:45:00.000Z", "source_id": "watch:abc",
"detail": { "load": 80, "title": "Easy run with Sam", "type": "run" } }
]
}]
Unknowns and caveats
When the data cannot support an answer, the packet says so rather than guessing. A user with nine nights of HRV asking "Is my HRV normal for me today?":
"findings": [{
"metric": "hrv_rmssd",
"unknown_reason": "baseline_building",
"direction": "unknown",
"magnitude": "unknown",
"statement": "Unknown: personal baseline needs 14 valid nights in the 28 before 2026-11-24"
}],
"data_quality": { …, "caveats": ["Personal baseline for hrv (rmssd) still building (9 of 14 valid days)"] }
A trend over a period with gaps and a stale sync carries both facts with the answer:
"findings": [{ "metric": "resting_hr", "direction": "down", "magnitude": "slight",
"statement": "Resting heart rate falling slightly over 24 days" }],
"data_quality": {
"freshness_hours": 87, "coverage": 0.86, "sources": ["apple_health"], "baseline_days": null,
"caveats": ["4 of 28 days have no resting heart rate data", "Last sync 87 hours ago; recent days may be missing"]
}
Other caveats you will see include low wear time, more than one device reporting a metric, a new device restarting a baseline, a time-zone or daylight-saving change in the window, estimated metrics such as VO2 max or sleep stages, and "Correlation is not cause" on every correlation.
The response envelope
ask and query wrap the packet in an envelope. The packet is repeatable; the envelope is not.
status | HTTP | Carries |
|---|---|---|
ok | 200 | packet, receipt_id, and the gate's reasons (for example window_clamped, level:1) |
denied | 403 | reasons, and a receipt_id once the user is identified. Denials are receipted too. |
unsupported | 200 | supported: a short list of what can be asked. The planner never guesses at a question outside the catalogue. |
Reasons are structured strings. The ones you will meet most:
| Reason | Meaning |
|---|---|
metric_not_in_grant:<metric> | The user did not grant this metric to this agent |
sensitive_not_named:<metric> | A sensitive category the grant did not name one by one |
terms_no_ai:<provider> | Data from that source is never sent to a model-facing agent; it was left out |
window_clamped, window_outside_grant | The window was cut to the grant's limit, or fell wholly outside it |
level_lowered_by_grant, level_lowered_by_purpose | The release was coarser than the operation would normally give |
budget_exhausted | The agent used its daily packet budget |
purpose_mismatch:<metric> | The metric is outside what the grant's purpose plausibly needs |
purpose_claim_ignored | The request stated a different purpose; the grant's purpose was used |
grant_expired, grant_revoked, paused, token_invalid | No valid grant, or the user paused all releases |
invalid_spec, unsupported:<why> | The spec did not validate, or the question could not be planned |
Operations
A question is answered by exactly one of eight operations over one metric (two for correlate). Retrieval is computation over the store, not text search.
| Operation | Answers | Lowest level | Parameters |
|---|---|---|---|
latest | "What was my resting heart rate today?" | 2 | |
aggregate | "How much did I sleep this week?" | 2 | statistic: total, mean, min, max |
trend | "Is my HRV going up?" | 1 | |
compare_to_baseline | "Am I rested?" | 1 | |
compare_periods | "Steps this month against last month" | 1 | compare_window |
threshold_check | "Did I sleep under 6 hours this week?" | 0 | comparator, threshold, threshold_unit, mode: any, all, count |
correlate | "Do I sleep better after exercise?" | 1 | lag_days: 0 or 1. Needs at least 20 paired days. |
list_sessions | "What workouts did I do?" | 2 | session_kind: workout or sleep |
A QuerySpec, as sent to POST /v1/query:
{
"spec": {
"metrics": ["sleep_duration"],
"operation": "threshold_check",
"window": { "start": "2026-11-18", "end": "2026-11-24" },
"params": { "comparator": "<", "threshold": 6, "threshold_unit": "h", "mode": "any" }
}
}
Unknown keys are rejected, windows are local dates (YYYY-MM-DD, inclusive) of at most two years, and the gate then clamps them to the grant.
Metric catalogue
Version 1. The catalogue is the single place a unit is defined; values are converted on ingest.
| Metric id | Label | Unit | Daily value | Note |
|---|---|---|---|---|
steps | Steps | count | Sum from one chosen source | Never summed across sources |
active_energy | Active energy | kcal | Sum | Estimates differ by vendor |
resting_hr | Resting heart rate | bpm | Vendor daily value, else lowest 30-minute mean | |
heart_rate | Heart rate | bpm | Mean | Series only at level 3 |
hrv_rmssd | HRV (RMSSD) | ms | Night mean | Kept separate from SDNN |
hrv_sdnn | HRV (SDNN) | ms | Night mean | Providers differ in which one they report |
sleep_duration | Sleep duration | minutes | Main sleep session | Attributed to the wake date |
sleep_efficiency | Sleep efficiency | percent | Asleep over time in bed | |
sleep_stages | Sleep stages | minutes | Per session | Consumer staging is an estimate |
spo2 | Blood oxygen | percent | Night mean | |
respiratory_rate | Respiratory rate | breaths/min | Night mean | |
skin_temp_deviation | Skin temperature deviation | degC | Night value | Deviation from the vendor's own baseline |
vo2max | VO2 max | ml/kg/min | Latest | Estimated |
weight | Weight | kg | Latest | |
workout | Workouts | minutes | Count, total minutes, load | Type mapped to a shared list |
Sensitive categories are listed so the gate can refuse them by name: blood_glucose, menstrual_cycle, ecg_classification and breathing_disturbances. They are never released unless a grant names each one individually, and they cannot be requested through a developer consent link.
