# 001 — Param declarations ## Summary Implement the `ParamDeclaration` slice of the primary index: users can declare how a named parameter is derived from a log line (e.g. deriving a timestamp different from the ingestion timestamp, or a log level), and the engine stores/serves those declarations. ## Scope - `IndexKey::ParamDeclaration { name }` and a matching `DataValue` variant for the declaration body (a regex against the raw log text, plus how the capture maps to a `MetricPrimitive` — reuse `RegexToMetricPrimitiveMatcher` / `MetricPrimitiveKind` from `data_value.rs`, which already exist but are unused). - Engine message(s) to add/list/remove a param declaration. - Validate declared regexes at declaration time (reject invalid regex / unknown primitive kind up front rather than failing per-log later). - No derivation/backfill against existing logs yet — that's [002](002-metric-declarations.md) / [003](003-metric-bucket-derivation.md), since metrics are what actually get indexed into buckets. This ticket is just the declaration storage + validation. ## Acceptance criteria - Declaring a param with a valid regex + capture group succeeds and is retrievable. - Declaring a param with an invalid regex or referencing a non-existent capture group is rejected with a clear error, not silently stored. - Declarations sit in their own contiguous range of the BTreeMap (`ParamDeclaration` between `LogParamSplit` and `ParamMetricSplit`), per the `IndexKey` ordering in the README. ## Depends on None — this is foundational.