kitt_score 0.1.0

Decision engine at the core of Project KITT — in-memory stateful matching with pluggable scoring backends.
Documentation
//! # `kitt_score`
//!
//! The decision engine at the core of **Project KITT**. See
//! `docs/superpowers/specs/2026-04-20-kitt-score-design.md` for the full
//! design; this crate-level doc gives a one-screen orientation only.
//!
//! ## Model
//!
//! - A **Location** is an abstract entity carrying (a) reference data loaded
//!   in bulk at startup, and (b) dynamic state updated by events.
//! - An **Event** is one of three flavors: `StateUpdate`, `ActionIngest`,
//!   or `Trigger`. They are separate types — there is no runtime discrimination
//!   on the hot path.
//! - An **Action** binds a scoring function + a generic payload `T` +
//!   start/end validity window at a location.
//! - The `Engine<T>` receives events and, on a `Trigger`, picks the
//!   highest-scoring valid action and returns its payload.
//!
//! The crate is deliberately transport-agnostic: there is no networking, no
//! persistence, no renderer. See the integration section of the spec for the
//! axum/tokio host pattern.
//!
//! ## Feature flags
//!
//! - `serde` — derives `serde::Serialize` on [`MetricsSnapshot`], enabling
//!   JSON serialisation in host integrations (e.g. the `axum_host` example).

#![forbid(unsafe_op_in_unsafe_fn)]
#![warn(missing_docs)]

pub mod ids;
pub use ids::{ActionId, AttrId, KindId, LocId, UnixTime};

pub mod schema;
pub use schema::{AttrType, OwnedValue, Schema, SchemaBuilder, Value};

pub mod clock;
pub use clock::{Clock, SystemClock, TestClock};

pub mod location;
pub use location::{LocationDef, LocationView};

pub mod scoring;
pub use scoring::{
    BuildErr, Candidate, ScoreResult, Scorer, ScorerBuilder, ScorerSpec, VectorBackend,
    VectorMetric,
};

pub mod event;
pub use event::{ActionIngest, AttrSet, Event, KindRef, StateUpdate, Trigger};

pub mod decide;
pub use decide::{Decide, DefaultDecider};

pub mod engine;
pub mod errors;
pub mod metrics;

pub use engine::{BuildError, Engine, EngineBuilder, Ingested, Outcome};
pub use errors::IngestErr;
pub use metrics::{EngineMetrics, MetricsSnapshot};