Skip to main content

Module effective

Module effective 

Source
Expand description

keel doctor --effective-policy — show the composed policy the core is given (the defaults/E005 CCR: front ends and CLI compose defaults < packs < user before keel_configure; the core layers no pack underneath, contracts/core-ffi.h).

effective_policy is the Rust twin of Python’s keel._defaults.apply_pack_defaults and Node’s defaults.mjs::applyPackDefaults: merge granularity is per KEY of defaults.outbound / defaults.llm (a higher layer replaces a key it sets wholesale, fills in the rest), and target tables pass through untouched — the engine resolves target → defaults precedence per key at execute time. The three implementations must agree byte-for-byte; the cross-language parity test in tests/cli.rs runs all three over the same fixture.

The Level 0 layer is the frozen smart-defaults pack itself, contracts/defaults.toml, embedded with include_str! so the binary and the contract can never drift (“this document ships compiled into the binary”). The printed policy is the PRE-resolution merge — cache = { mode = "dev" } stays symbolic (the front ends resolve it against KEEL_ENV at run time), keeping the --json twin byte-deterministic.

Functions§

effective_policy
Compose the effective policy: defaults < packs < user, per-key wholesale on the defaults.outbound / defaults.llm tables, target tables untouched. Returns a NEW value; the input is never borrowed mutably. Idempotent on the embedded Level 0 policy. Byte-identical (as sorted JSON) to Python apply_pack_defaults and Node applyPackDefaults over the same inputs.
llm_pack_fragment
The generic [defaults.llm] pack fragment — what the provider packs and the AI-SDK middleware contribute (Python provider_defaults(), Node llmPack.defaults()). Folding it is the identity over the embedded defaults, by construction.
run
Run keel doctor --effective-policy for project.