Expand description
P4c (COMPOSABLE-HARNESS-DESIGN.md §5.2 “P4” core NEW-significant item,
§1.10/§3.1 core.model_switch.allow_switch, D9 row): a persisted,
TYPED record of a mid-session model switch — pi’s model_change
precedent (design §1.10: “persisted change records … pi’s model_change
is the cleanest precedent”). Deliberately flat/typed (not a formatted
string), mirroring crate::usage_log::UsageRecord’s exact rationale:
a translatable, lossless session-data channel (§1.13), not a lossy
notice — so it survives a save/load round trip byte-for-byte in the
fields that matter, and a future reader (a translator emitting this same
session under another harness’s format, a doctor/inspect stats
command) can consume it without re-parsing prose.
Structs§
- Model
Change Record - One mid-session model switch, as
Agent::switch_modelrecords it whenConfig::model_switch_allow_switchis on (see that field’s doc comment for the exact gate — with the knob off,switch_modelnever creates one of these at all, matchingAgent::set_model’s pre-existing, record-free mechanics byte-for-byte).
Functions§
- from_
jsonl - Parse a JSONL model-change log back into records — the exact inverse of
to_jsonl. Blank lines are skipped; a malformed line is a hard error (likecrate::usage_log::from_jsonl— this is accounting/provenance data, corruption should be visible, not silently dropped). - to_
jsonl - Serialize
recordsas JSONL (oneModelChangeRecordper line) — the same shapecrate::usage_log::to_jsonland every other append-log in this crate uses. Never fails on an empty slice (produces an empty string).