feat: saving mode — the meter tells the model which tariff it is standing in - #3
feat: saving mode — the meter tells the model which tariff it is standing in#3lroolle wants to merge 1 commit into
Conversation
…ding in Off by default; with savingMode: true the meter contributes one system-prompt section (meter:tariff) evaluated at every assembly, naming the tariff the next request will be dispatched under — the same clock the billing fold uses. Inside a peak window it carries savingPeakPrompt (a built-in nudge naming the peak hours and asking for economical behavior, or a custom string); outside, savingOffPeakPrompt, empty by default so silence costs zero prompt tokens. The text is byte-identical inside a tariff window so the prompt-prefix cache holds until a boundary flips. Adds tests/prompt.spec.mjs (6 tests; 56 total), regenerates the client bundle and site, and updates both READMEs, CHANGELOG (0.3.0), CONTRIBUTING's model-surface rule, and llms.txt.
|
Housekeeping sweep, 2026-08-21: this branch is what npm serves as Unpacking the 0.3.0 tarball and diffing it against
So the two diverged in both directions. What is not wrong, checked rather than assumed: This branch is also 10 commits behind main, so it needs a rebase before it can Not touching npm from here — republishing is yours to call. The two coherent
Either is fine. Worth a guard afterwards either way: publish from CI on a tag, so a version can |
What
Off by default, the meter stays the readout it has always been — no model surface (the repo's own rule, now amended to "empty by default"). Flip
savingMode: truein the plugin config and the meter contributes one system-prompt section,meter:tariff, evaluated at every assembly, telling the model which tariff the next request will be dispatched under.Why this design
tariffAt(Date.now())at assembly time — the same function and clock the billing fold uses, so the nudge and the bill cannot disagree about which side of a boundary the next request lands on.savingOffPeakPrompt, empty by default, andrenderPromptdrops empty sections — zero prompt tokens when there is nothing to warn about.Config
savingModefalsesavingPeakPromptsavingOffPeakPrompt''Tests / docs
tests/prompt.spec.mjs— 6 tests: silence when off, built-in nudge inside both peak windows, verbatim custom text, silence off-peak by default, silence under the retired flat tariff, text stability inside a window. 56 tests, CI green locally.lib/client.jsanddocs/index.htmlregenerated (bundle/site sync checks pass).Verification
Live composition probe against the real harness
SystemPromptservice (off-peak clock): sectionsharness:identity, deployment:persona, meter:tariff; text""off-peak; customsavingOffPeakPromptflows through verbatim.