Expand description
In-band behavior nudges + turn-economy telemetry.
tools health measured two waste patterns this module targets (#848
follow-up):
- Heavy reads — explicit
mode=full/rawdominated recordedctx_readmodes (62% at introduction time) while the structural modes (signatures/map) cover orientation at a fraction of the tokens. - Tool-call chains —
ctx_search→ctx_read→ctx_search/ctx_callgraphsequences that a singlectx_composecall bundles; every extra turn re-reads the whole conversation server-side.
The mechanism is one trailing hint line appended to a tool result at the
moment of waste — in-conversation context outweighs static rules. Hints
are budgeted hard: at most one hint per pattern per server process
(~30 tokens each), gated by the behavior_nudges config key
("auto" default | "off"). Every detection is also counted in a small
local store so tools health reports the pattern honestly even with
hints off. Deterministic thresholds, local-only state, no network.
Functions§
- observe
- Observes one dispatched tool call. Counts detections in the persistent
store and returns a hint line to append at most once per pattern per
session —
Nonewhen there is nothing to say.can_showsuppresses the hint (machine-readable or firewalled results) without burning the once-per-session budget; detections are counted either way. Called post-dispatch, so it must stay cheap: no I/O unless a (rare) detection fired.