Skip to main content

Module nudge

Module nudge 

Source
Expand description

The nudge/progress engine (Phase 18 #9). Public so the as-yet-unwired scorer is part of the lib API surface; the aristo nudge emitter (S0d) is its in-crate consumer. The nudge/progress engine’s DECIDE leg (Phase 18 #9, S0c).

A plug-and-play scorer over a registry of Signals. Each signal turns some engine input into a raw “pressure” m; the scorer normalizes it by the signal’s base b and scales by the configured aggressiveness factor f, firing iff pressure * f >= 1. Adding a nudge is one SIGNALS entry — the scorer, ordering, and (later) throttle/render are generic.

Two design invariants this module enforces:

  • aggressiveness = off is a hard silence. factor() is 0.0, so pressure * 0.0 >= 1 is false for every signal at every pressure — nothing can fire (cf. the aggressiveness_off_is_hard_silence intent in aristo-core::config).
  • Ordering is fixed priority, not pressure. Pressures of counts and fractions are incommensurable, so the surfaced order is the static SIGNALS order (congrats banner, then review > canon > verify > proof-review > slump); the Agent-audience signal is a separate surface.

Modules§

intents
Enumerate authored intents for the reviewed/unreviewed axis (Phase 18 #7).
state
Persistent, git-untracked engine state: .aristo/nudge-state.toml (Phase 18 #9, S0c). Holds the runtime facts the index can’t carry:
throttle
Anti-nag throttle for the human-facing nudge surface (Phase 18 #9, S0d).

Structs§

Decision
The scorer’s verdict: the fired signals in priority order, split by audience, plus the recommended lead (the highest-priority fired human signal — the engine kicks its low-friction/background action).
EngineInputs
Everything the signal metrics read. The cli’s union function (S0c+) populates the runtime fields it can’t see from the index alone (reviewed map, queue/canon counts, the edit-window baseline); the index-derived part is Metrics.
Fired
A signal that fired, with the pressure that fired it and the raw metric/base (so the throttle can apply a material-increase re-arm against the same numbers).
Signal
A registered nudge. metric extracts the raw pressure numerator m from the inputs; base is the denominator b; the signal fires when (m / b) * factor >= 1.

Enums§

Audience
Who a fired signal is addressed to. The two are surfaced through different channels (D4/D10): the agent gets an inline <system-reminder>; the human gets the consolidated review prompt the agent pops.

Statics§

SIGNALS
The registry. Order IS priority for the human surface: the congrats banner leads, then review > canon > verify > proof-review > slump. The Agent-audience authoring_debt sits last (separate channel, order among human signals irrelevant to it).

Functions§

score
score_authoring_debt
Score ONLY the authoring_debt signal, from the edit counter alone — no EngineInputs/Metrics and so no source walk (PostToolUse fires on every edit and must stay cheap). Returns the Fired (carrying metric + base for the throttle) when it fires.