# Fact hydration

**Not in this edition.** Every clause in this document is deferred or retired, so nothing here binds a 1.0 implementation. It is kept so that its ids and the references to them resolve.


On-demand loading of
historical data as facts: a rule issues an async call to
an adapter that holds history; the adapter asserts
matching records back into the engine's working memory as
facts of the requested schema, bounded by a correlation id
and an explicit TTL.

Paired with:
- [LSTO] — the facts and samples planes
  hydration reads from.
- [LCRS] — the call/response
  machinery hydration calls build on (async dispatch,
  correlation, `CallError`).
- [LSER] — hydrated facts interact with
  series (hydrated-facts-don't-feed-series rule below).
- [LFAC] — lifecycle semantics.

## What this is not

- Not a subscription model — every hydration is
  explicitly requested; nothing continuous.
- Not `cached(...)` — cache is sync-intent KV
  current-state; hydration is async multi-fact historical
  load.
- Not a replacement for live facts — hydration is a
  snapshot at query time.
- Not a grammar for arbitrary backend queries — caller
  specifies schema + simple predicate + window.
- Not an implementation spec — see
  [RHIM].

---

(LHYD-1)=
## What hydration is for [LHYD.1]

*Deferred: not binding in this edition.*

(LHYD-1-1)=
[LHYD.1.1] Things rules cannot do without hydration:

(LHYD-1-2)=
- [LHYD.1.2] **Daily summary rules.** "At 08:00, summarize the alarms
  from the last 24_h." The rule needs `Alarm` facts from a window no
  live rule kept in working memory.

(LHYD-1-3)=
- [LHYD.1.3] **Cold-start correlation.** After an engine restart,
  working memory is empty. A rule wanting "did we see a
  `Person` near the front door in the last hour" has no
  way to rehydrate that history without reading the event
  log and re-asserting matching facts.

(LHYD-1-4)=
- [LHYD.1.4] **Cross-window joins.** "For each `DoorOpen` in the last
  hour, find the nearest `Person` detection within 30
  seconds." Expressible only if both fact sets are in
  working memory at once.

(LHYD-1-5)=
- [LHYD.1.5] **Retrospective pattern-matching.** "Did any sensor trip
  more than N times yesterday, and if so, which zone?"
  Pattern-matching on the individual contributing facts
  needs them in working memory.

(LHYD-1-6)=
[LHYD.1.6] Hydration is the only read of the facts plane ([LSTO.2.3.1]):
the store cannot see inside a record, so it returns the matching records as
facts and a rule counts or aggregates them in working memory, or reads
`HydrationComplete`'s `count` ([LHYD.5.1]).

---

*see also:* [LHYD.5.1](#LHYD-5-1), [LSTO.2.3.1](#LSTO-2-3-1)

(LHYD-2)=
## Two canonical endpoints [LHYD.2]

*Deferred: not binding in this edition.*

(LHYD-2-1)=
### `call hydrate_facts` [LHYD.2.1]

(LHYD-2-1-2)=
[LHYD.2.1.2] The storage adapter selects the stored facts of the named
schema that entered working memory within the requested window, up to the
call's `limit:` ([LHYD.7.2.1]), and returns them to the engine. It selects by
what it can see beside each opaque record — schema, time and count — and by
nothing inside it ([LSTO.2.1]). The adapter hands each record back with the
call's correlation and `retain:` duration, and the engine decodes it, sets
`corr` and asserts it into working memory ([NCBK.9.2]). The call takes no
`filter:` ([LHYD.8.1]); rules filter the hydrated facts as they match them.

*see also:* [LHYD.7.2.1](#LHYD-7-2-1), [LHYD.8.1](#LHYD-8-1), [LSTO.2.1](#LSTO-2-1), [NCBK.9.2](#NCBK-9-2)

(LHYD-2-2)=
### `call hydrate_samples` [LHYD.2.2]

(LHYD-2-2-2)=
[LHYD.2.2.2] The storage adapter queries its samples plane and asserts
each matching sample as a `HydratedSample` fact (see
[LHYD.4]).

*see also:* [LHYD.4](#LHYD-4)

(LHYD-2-3)=
### Beyond storage [LHYD.2.3]

(LHYD-2-3-1)=
[LHYD.2.3.1] The mechanism is general. Any adapter with historical data
can offer `hydrate_*` endpoints. Candidates:

(LHYD-2-3-2)=
- [LHYD.2.3.2] `hydrate_state_history` — a hub adapter's
  recorder history as facts.

(LHYD-2-3-3)=
- [LHYD.2.3.3] `hydrate_predictions` — an ML worker adapter's historical model
  predictions as facts.

(LHYD-2-3-4)=
[LHYD.2.3.4] The spec below defines the contract; each adapter decides
what to offer.

---

(LHYD-3)=
## Correlation [LHYD.3]

*Deferred: not binding in this edition.*

(LHYD-3-1)=
[LHYD.3.1] Every hydration call carries an `as "<id>"` binding naming
the call, same shape as the general call/response pattern.
The adapter sets every hydrated fact's `corr` slot ([LHYD.4.1.7]) to that id,
so rules can scope matches to one hydration.

*see also:* [LHYD.4.1.7](#LHYD-4-1-7)

(LHYD-3-2)=
[LHYD.3.2] A rule matching `HydrationComplete` ([LHYD.5.1]) with the
call's correlation fires once, when the hydration completes; a rule matching
the hydrated schema with that `corr` fires per hydrated fact.

---

*see also:* [LHYD.5.1](#LHYD-5-1)

(LHYD-4)=
## Hydrated fact shape [LHYD.4]

*Deferred: not binding in this edition.*

(LHYD-4-1)=
### Facts [LHYD.4.1]

(LHYD-4-1-1)=
[LHYD.4.1.1] Hydrated facts use the **same schema** as live facts. The
schema declares `corr` ([LHYD.4.1.7]), which reads `""` on a live fact and the
hydration call's correlation on a hydrated one; [LHYD.4.1.2]'s match forms rely
on that.

*see also:* [LHYD.4.1.2](#LHYD-4-1-2), [LHYD.4.1.7](#LHYD-4-1-7)

(LHYD-4-1-2)=
[LHYD.4.1.2] Rules match:

(LHYD-4-1-3)=
- [LHYD.4.1.3] **Hydrated-only** — the pattern constrains `corr` to the hydration's
  correlation.

(LHYD-4-1-4)=
- [LHYD.4.1.4] **Live-only** — the pattern constrains `corr` to `""`.

(LHYD-4-1-5)=
- [LHYD.4.1.5] **Both** — the pattern leaves `corr` unconstrained.

(LHYD-4-1-6)=
[LHYD.4.1.6] This gives authors fine-grained control over what they
match. Chosen over a wrapper-schema (`HydratedAlarmTriggered`)
approach for composability — authors can treat hydrated
and live together when they want, and separate when they
don't, without forking every rule.

(LHYD-4-1-7)=
- [LHYD.4.1.7] **A hydration target declares `corr`.** A schema named in a
  hydration service's `hydrates:` list ([LHYD.9.4.1]), a schema named by the
  `schema:` of a `hydrate_facts` call ([LSTO.13.1]), and the builtin
  `HydratedSample` ([LHYD.4.3.1]) are **hydration targets**. A hydration target
  must declare `corr` ([LCRS.4.3.2]) as a non-nullable `String`; the compiler
  must reject one that does not (`DS_VALIDATE_HYDRATE_TARGET_NO_CORR`). The
  compiler adds no slot to it.

  A fact of a hydration target asserted without a value for `corr` must read
  `""`, the zero of `String`; the adapter sets `corr` on every fact it
  hydrates ([LHYD.3.1]). So on a hydration target `corr` marks a fact as
  history: a non-empty `corr` is a hydrated fact, and the live-only match
  ([LHYD.4.1.4]) and the series skip ([LHYD.10.4.1]) key on it.

  **On a `logical` hydration target, `corr` is a `key` slot** ([LFAC.1.7.1]),
  so a hydrated fact never shares an identity with a live one and never
  replaces it; facts hydrated under different correlations are distinct too.
  The compiler must reject a `logical` hydration target whose `corr` is marked
  `mutable` (`DS_VALIDATE_HYDRATE_TARGET_CORR_NOT_KEY`).

  **No schema is both a hydration target and a response schema**
  ([LCRS.4.3.2]). On a response schema `corr` names the call a live fact
  answers, so a schema in both roles would give one slot two meanings. The
  compiler must reject a schema that is both
  (`DS_VALIDATE_CORR_ROLE_CONFLICT`).

*see also:* [LCRS.4.3.2](#LCRS-4-3-2), [LHYD.10.4.1](#LHYD-10-4-1), [LHYD.3.1](#LHYD-3-1), [LHYD.4.1.4](#LHYD-4-1-4), [LHYD.4.3.1](#LHYD-4-3-1), [LHYD.9.4.1](#LHYD-9-4-1), [LSTO.13.1](#LSTO-13-1), [LFAC.1.7.1](#LFAC-1-7-1)

(LHYD-4-2)=
### The negation footgun [LHYD.4.2]

(LHYD-4-2-1)=
[LHYD.4.2.1] A rule that writes `no AlarmTriggered within 30_s` matches
when *no* live or hydrated fact exists. If another rule
elsewhere hydrates `AlarmTriggered` for retrospective
analysis, the negation silently starts failing to match
(there are hydrated facts around).

(LHYD-4-2-2)=
[LHYD.4.2.2] Live-only negation is written by constraining `corr`
to the empty string inside the negation, so hydrated instances of the schema
do not satisfy it.

(LHYD-4-2-3)=
[LHYD.4.2.3] This is a documented convention, not compiler-enforced.

(LHYD-4-3)=
### Samples [LHYD.4.3]

(LHYD-4-3-1)=
[LHYD.4.3.1] Samples have no schema in the same sense — they are
`(entity_id, field, ts, value)` tuples. Hydrated samples arrive as a
dedicated `HydratedSample` schema, `ttl`-scoped at 24_h, whose slots are:

| Slot | Type | Meaning |
|---|---|---|
| `adapter` | String | which adapter supplied the sample |
| `entity_id` | String | the entity the sample belongs to |
| `field` | String | the sampled field |
| `ts` | Time | sample timestamp, source time ([LFAC.9.2]) |
| `value` | Float | the value, or stringified per `value_type` |
| `value_type` | String | `"Float"`, `"Int"`, `"String"` or `"Bool"` |
| `corr` | String | correlation id of the hydration that produced it |

*see also:* [LFAC.9.2](#LFAC-9-2)

(LHYD-4-3-2)=
[LHYD.4.3.2] One `HydratedSample` fact per raw sample. Result caps
matter — a 30-day window with second-resolution samples is
millions of facts.

---

(LHYD-5)=
## Completion signal [LHYD.5]

*Deferred: not binding in this edition.*

*checks:* `tla`

(LHYD-5-1)=
[LHYD.5.1] When the adapter has asserted the last fact of a hydration it
emits a single `HydrationComplete` fact, `ttl`-scoped at 5_min. It is emitted
once per hydration call, after every matching fact has been asserted, and
signals that rules matching on the hydrated set may fire. It is the hydration
call's response fact ([LCRS.4.3.1]): every hydration service declares
`response HydrationComplete` ([LADP.8.4.2]).

| Slot | Type | Meaning |
|---|---|---|
| `corr` | String | correlation id from the `as` binding |
| `schema_name` | String | schema name queried |
| `count` | Int | facts asserted this hydration |
| `truncated` | Bool | whether the call hit its `limit:` |
| `t_start` | Float | window start, epoch seconds |
| `t_end` | Float | window end, approximately the call time |

*see also:* [LADP.8.4.2](#LADP-8-4-2), [LCRS.4.3.1](#LCRS-4-3-1)

(LHYD-5-2)=
[LHYD.5.2] Rules that need to react *after* all hydrated facts exist
match on `HydrationComplete corr == "…"` and then pattern
against the hydrated facts. Rules that react per-fact as
they arrive can match directly on the hydrated facts
without waiting for completion.

(LHYD-5-3)=
[LHYD.5.3] The adapter's contract is that `HydrationComplete` is
emitted strictly **after** all matching facts — rules
matching on it are guaranteed to see the full hydrated set
first. Wire-ordering mechanism that makes this work is a
runtime-adapter concern.

---

(LHYD-6)=
## TTL and retraction [LHYD.6]

*Deferred: not binding in this edition.*

(LHYD-6-1)=
[LHYD.6.1] Hydrated facts can't live forever, or working memory
saturates. Three retraction paths, listed in decreasing
commonality:

(LHYD-6-2)=
### 1. `retain:` kwarg (required) [LHYD.6.2]

(LHYD-6-2-1)=
[LHYD.6.2.1] Every hydration call **must** include `retain: <dur>`. The
adapter tags each hydrated fact with an expiry timestamp;
an engine-side timer retracts the fact when the timer
fires. `retain:` is author-controlled budget.

(LHYD-6-2-2)=
[LHYD.6.2.2] Omitting `retain:` is a compile error. The consequence of
forgetting a retain value (working memory filling with
orphaned hydrated facts until engine OOM) is high enough
that one mandatory kwarg per hydration call is the right
ergonomic tradeoff.

(LHYD-6-3)=
### 2. Superseding correlation [LHYD.6.3]

(LHYD-6-3-1)=
[LHYD.6.3.1] A subsequent `hydrate_*` call with the same `as`
correlation retracts all facts from the prior hydration
before asserting new ones. This is what makes a "refresh on
trigger" rule idempotent.

(LHYD-6-5)=
### No `logical` involvement [LHYD.6.5]

(LHYD-6-5-1)=
[LHYD.6.5.1] Hydrated facts do **not** auto-retract when the *calling*
rule stops matching. Their lifetime is explicit — `retain:`
expiry, superseding correlation, or explicit retract.
Logical-emit semantics are for derived in-memory state,
not hydrated historical data.

---

(LHYD-7)=
## Result caps [LHYD.7]

*Deferred: not binding in this edition.*

(LHYD-7-1)=
[LHYD.7.1] A naive rule asking for "samples of sensor.X over 30 days"
would hydrate millions of facts; working memory degrades
past ~100k facts. Three bounds apply:

(LHYD-7-2)=
### 1. Caller-declared `limit:` [LHYD.7.2]

(LHYD-7-2-1)=
[LHYD.7.2.1] If the adapter finds more than `limit:`, it returns
`truncated: true` on the `HydrationComplete` and does not
assert past the cap. Default: adapter-specific per the
`hydrates:` manifest (see [LHYD.9]).

*see also:* [LHYD.9](#LHYD-9)

(LHYD-7-3)=
### 2. Adapter-enforced maximum [LHYD.7.3]

(LHYD-7-3-1)=
[LHYD.7.3.1] The adapter declares a hard cap per schema/endpoint in the
`service` declarations of its `.ds` library file
([LADP.8.2.1]). Calls requesting `limit:` above this cap
are a **compile error** — the compiler validates against
the declaration.

*see also:* [LADP.8.2.1](#LADP-8-2-1)

(LHYD-7-4)=
### 3. Engine-global budget [LHYD.7.4]

(LHYD-7-4-1)=
[LHYD.7.4.1] The engine monitors total hydrated facts in working
memory; starts rejecting new hydrations past a global
budget with a `CallError` whose code indicates budget
exhaustion. This is a runtime safety net, not an author-
facing contract.

(LHYD-8)=
## Adapter-side filter [LHYD.8]

*Deferred: not binding in this edition.*

(LHYD-8-1)=
[LHYD.8.1] Hydration calls accept an optional `filter:` kwarg — a
boolean expression the adapter applies at query time,
before asserting facts. Reduces wire traffic and
hydrated-fact count.

The storage library's hydration services declare no `filter_fields`
([LSTO.13.1]), so a `filter:` on them is a compile error ([LHYD.8.3.5]): the
store cannot see inside a record ([LSTO.2.1]), and rules filter the hydrated
facts as they match them.

*see also:* [LHYD.8.3.5](#LHYD-8-3-5), [LSTO.13.1](#LSTO-13-1), [LSTO.2.1](#LSTO-2-1)

(LHYD-8-2)=
[LHYD.8.2] The kwarg is spelled `filter`, not `where`: `where` is the
LHS-predicate keyword and reusing it here would overload it. Its
grammatical shape is a regular kwarg (`filter: <expression>`).

Both spellings are reserved words ([LLEX.9.5]) — `filter` is a
language-defined kwarg name, not an author-chosen one.

*see also:* [LLEX.9.5](#LLEX-9-5)

(LHYD-8-3)=
### Adapter filter-capability manifest [LHYD.8.3]

(LHYD-8-3-1)=
[LHYD.8.3.1] Adapters that support filtering declare, in `filter_fields:` on
the endpoint's `service` declaration, each slot a filter may name and the
operators it accepts on that slot ([LHYD.9.4.1], [LGRA.23.1]).

*see also:* [LGRA.23.1](#LGRA-23-1), [LHYD.9.4.1](#LHYD-9-4-1)

(LHYD-8-3-2)=
[LHYD.8.3.2] The compiler validates `filter:` expressions against the
manifest:

(LHYD-8-3-3)=
- [LHYD.8.3.3] Referencing a field not in `filter_fields` → compile
  error.

(LHYD-8-3-4)=
- [LHYD.8.3.4] Using an operator not in `filter_ops` → compile error.

(LHYD-8-3-5)=
- [LHYD.8.3.5] Calling an adapter with no `filter_fields` and passing
  `filter:` → compile error ("adapter does not support
  adapter-side filter").

(LHYD-8-3-6)=
[LHYD.8.3.6] Authors needing filters the adapter can't do filter in the
rule after hydration — at the cost of wire traffic and
hydrated-fact count.

---

(LHYD-9)=
## The hydration call's grammar [LHYD.9]

*Deferred: not binding in this edition.*

(LHYD-9-1)=
[LHYD.9.1] Hydration calls use the standard `call` grammar with
contract-validated kwargs ([LGRA.10]); the validation is all at
compile-time contract against the adapter's `hydrates:` manifest.

*see also:* [LGRA.10](#LGRA-10)

(LHYD-9-2)=
[LHYD.9.2] Kwargs on hydration calls:

| Kwarg | Required | Meaning |
|---|---|---|
| `schema:` | yes (`hydrate_facts`) | schema name to query |
| `entity:` / `field:` | yes (`hydrate_samples`) | sample source |
| `window:` | yes | how far back to query |
| `as` | yes | correlation id (string) |
| `retain:` | yes | how long hydrated facts live |
| `limit:` | no | caller's result cap |
| `filter:` | no; not on the storage library's services ([LHYD.8.1]) | adapter-side predicate |
| `cooldown:` | yes (per the general `call` rule) | rate-limit on this hydration call |

*see also:* [LHYD.8.1](#LHYD-8-1)

(LHYD-9-3)=
[LHYD.9.3] No `nocooldown` on hydration — the cost is high enough
that the compiler requires a real cooldown duration. This
is an adapter-contract restriction enforced against
`hydrate_*` endpoints specifically.

(LHYD-9-4)=
### Adapter manifest (schemas and caps) [LHYD.9.4]

(LHYD-9-4-1)=
[LHYD.9.4.1] An adapter that supports hydration publishes a `service`
declaration per `hydrate_*` endpoint, naming the schemas it can serve and the
caps it enforces, in a `hydration:` block that sits in the `service_decl` of
[LGRA.23.1] immediately before its `response_decl`. The compiler reads these
declarations, which is what makes [LHYD.9.4.2]'s validation enforceable at
compile time.

```
hydration_decl  ::= 'hydration' ':' NEWLINE
                    INDENT hydration_field+ DEDENT
hydration_field ::= 'hydrates' ':' NAME (',' NAME)* ','? NEWLINE
                 |  'max_window' ':' UNIT_LIT NEWLINE
                 |  'max_limit' ':' INT_LIT NEWLINE
                 |  'filter_fields' ':' NEWLINE
                    INDENT filter_field+ DEDENT
filter_field    ::= NAME ':' filter_op (',' filter_op)* ','? NEWLINE
filter_op       ::= '==' | '!=' | '<' | '<=' | '>' | '>=' | 'in'
```

Each `hydration_field` kind appears at most once in one `hydration_decl`; the
compiler must reject a repeated one
(`DS_VALIDATE_SERVICE_DUPLICATE_HYDRATION_FIELD`).

| Field | Meaning |
|---|---|
| `hydrates:` | the schema names this endpoint can serve |
| `max_window:` | the largest `window:` it accepts |
| `max_limit:` | the largest `limit:` it accepts |
| `filter_fields:` | each slot a `filter:` expression may name, with the comparison operators it may use on that slot |

*see also:* [LGRA.23.1](#LGRA-23-1), [LHYD.9.4.2](#LHYD-9-4-2)

(LHYD-9-4-2)=
[LHYD.9.4.2] The compiler validates every `call hydrate_*`
against this manifest:

(LHYD-9-4-3)=
- [LHYD.9.4.3] `schema:` must appear in `hydrates:` — else compile
  error.

(LHYD-9-4-4)=
- [LHYD.9.4.4] `window:` must be ≤ `max_window` — else compile error.

(LHYD-9-4-5)=
- [LHYD.9.4.5] `limit:` (if present) must be ≤ `max_limit` — else
  compile error.

(LHYD-9-4-6)=
- [LHYD.9.4.6] `filter:` uses only declared fields and ops — else
  compile error.

---

(LHYD-10)=
## Interactions with other mechanisms [LHYD.10]

*Deferred: not binding in this edition.*

(LHYD-10-1)=
### Live facts [LHYD.10.1]

(LHYD-10-1-1)=
[LHYD.10.1.1] Stream in independently. Hydrated facts carry
`corr != ""`; live facts carry `corr == ""`
([LHYD.4.1.7]). The rule author picks which to
match. Both are the same schema.

*see also:* [LHYD.4.1.7](#LHYD-4-1-7)

(LHYD-10-2)=
### Storing facts [LHYD.10.2]

(LHYD-10-2-1)=
[LHYD.10.2.1] The facts plane is the source of what `hydrate_facts`
pulls from: the facts rules stored with `record_fact`
([LSTO.2.2.1]). A live fact is stored with the `corr` it has, `""`; a
hydrated copy of it carries the hydration's correlation ([LHYD.3.1]).

*see also:* [LHYD.3.1](#LHYD-3-1), [LSTO.2.2.1](#LSTO-2-2-1)

(LHYD-10-3)=
### Cache plane [LHYD.10.3]

(LHYD-10-3-1)=
[LHYD.10.3.1] Orthogonal. Cache holds current state; hydration brings
history. Rules may cache a hydration's summary (count,
threshold breach) for fast subsequent sync-intent access
via `cached(...)`. The engine does not auto-cache
hydration results.

(LHYD-10-4)=
### Series [LHYD.10.4]

(LHYD-10-4-1)=
[LHYD.10.4.1] **Series skip hydrated facts by default.** The series
runtime ignores updates for facts of a hydration target whose `corr` is
non-empty ([LHYD.4.1.7]). This stops a 24_h retrospective hydration
from polluting a 10_min-window live-data series with a burst
of replayed historical values.

*see also:* [LHYD.4.1.7](#LHYD-4-1-7)

(LHYD-10-4-2)=
[LHYD.10.4.2] Hydrated facts stay in working memory for rules to match;
they do not feed series state.

(LHYD-10-5)=
### Logical facts [LHYD.10.5]

(LHYD-10-5-1)=
[LHYD.10.5.1] Logical emits can match on hydrated facts (their
`corr` is part of the pattern like any other
slot). The logical fact's lifetime is bounded above by the
shortest-lived element in its LHS — if the LHS includes a
hydrated fact whose `retain:` window is 10_min, the logical
fact retracts at hydration TTL. See
[LLOG].

(LHYD-10-6)=
### Cross-hydration joins [LHYD.10.6]

(LHYD-10-6-1)=
[LHYD.10.6.1] Two hydrations with different correlations produce
independent fact sets. Rules can join them freely (on
entity match, temporal proximity, etc.). `limit:` applies
**per-hydration**, not across — two `limit: 1000` calls
can contribute 2000 facts combined. Multi-hydration rules
should size their limits with the combined footprint in
mind.

---

(LHYD-11)=
## Cost notes [LHYD.11]

*Deferred: not binding in this edition.*

(LHYD-11-1)=
[LHYD.11.1] Hydration is a potentially-expensive operation. Authors
control cost through the standard call-action primitives:

(LHYD-11-2)=
- [LHYD.11.2] **`cooldown:`** — required on every hydration call.
  The engine suppresses a repeated hydration inside the cooldown window
  as it suppresses any `call` ([LCRS.8.2]): per call site, keyed by the
  declared `key` slots of the `logical` facts the activation binds.

*see also:* [LCRS.8.2](#LCRS-8-2)

(LHYD-11-3)=
- [LHYD.11.3] **`limit:`** — caps hydrated-fact count per call.

(LHYD-11-4)=
- [LHYD.11.4] **`retain:`** — caps fact lifetime in working memory.

(LHYD-11-5)=
- [LHYD.11.5] **`filter:`** — pushes selectivity to the adapter side.

(LHYD-11-6)=
[LHYD.11.6] Adapter-side rate limits, backpressure, and metrics are
runtime concerns — not author-visible beyond the
possibility of a `CallError` — `request.limit_exceeded`, or an
`adapter.*` code ([LECC.4.3]).

---

*see also:* [LECC.4.3](#LECC-4-3)

(LHYD-12)=
## Hydration commitments [LHYD.12]

*Deferred: not binding in this edition.*

(LHYD-12-1)=
- [LHYD.12.1] **Same schema + a declared `corr` slot.** Hydrated facts
  use the live schema, which declares `corr` to distinguish them; not a
  wrapper. Composes cleanly with rule patterns ([LHYD.4.1.7]).

*see also:* [LHYD.4.1.7](#LHYD-4-1-7)

(LHYD-12-2)=
- [LHYD.12.2] **`HydrationComplete` signal fact** emitted after the
  last hydrated fact. Wire-ordering contract guarantees
  rules matching on it see the full hydrated set first.
  Restates [LHYD.5.3].

*see also:* [LHYD.5.3](#LHYD-5-3)

(LHYD-12-3)=
- [LHYD.12.3] **`retain:` required on every hydration call.** Compile
  error if omitted. The consequence of forgetting is high
  enough that one mandatory kwarg per call is the right
  tradeoff.
  Restates [LHYD.6.2.2].

*see also:* [LHYD.6.2.2](#LHYD-6-2-2)

(LHYD-12-4)=
- [LHYD.12.4] **Adapter-side filter-push uses `filter:`.** A keyword
  distinct from the LHS predicate word `where` ([LGRA.2.6]).

*see also:* [LGRA.2.6](#LGRA-2-6)

(LHYD-12-5)=
- [LHYD.12.5] **Compile-time validation against adapter manifest.**
  Schema, window, limit, filter fields/ops all checked
  against the adapter's `hydrates:` manifest at compile.

(LHYD-12-6)=
- [LHYD.12.6] **Series skip hydrated facts.** Prevents
  retrospective-data bursts from polluting live series.

(LHYD-12-7)=
- [LHYD.12.7] **Mechanism is general, not storage-specific.** Any
  adapter with history offers `hydrate_*`
  endpoints. Storage is the v1 primary implementation;
  HA-bridge, ML-workers and other adapters add hydration
  with the same spec.

(LHYD-12-8)=
- [LHYD.12.8] **Hydrated-fact lifetime is explicit** (`retain:`, superseding correlation, explicit
  retract), not justified by rule activations.

(LHYD-12-9)=
- [LHYD.12.9] **Authors cache hydration summaries explicitly** via `cache` when sync-access
  matters.

(LHYD-12-10)=
- [LHYD.12.10] **Three result caps.** Caller-declared `limit:` for
  ergonomics; adapter-enforced `max_limit` for guardrails;
  engine-global budget for safety net.

(LHYD-13)=
## Startup hydration [LHYD.13]

*Deferred: not binding in this edition.*

(LHYD-13-3)=
- [LHYD.13.3] **Warmup hydration at engine startup.** An author may
  declare warmup hydrations that run at engine start to
  seed working memory from recent history. Declaration
  syntax is a runtime/config concern; the author-visible
  contract is that hydrated facts may exist at boot.

