Long conversations drift, and a model ten turns in is deep in a detail while the reason the session exists has scrolled away. focus puts it back: on every fifth turn it inserts one system message with the goal and asks whether the last step was closer to it. Details that matter and are tested: - one reminder per turn at most, even if compaction runs twice; - inserted BEFORE the newest user message, so the model reads goal then request and answers the request instead of treating the goal as a reply; - nothing at all without a goal: no goal, no noise; - the goal comes from the operator (config key goal -> SPLINTER_FOCUS_GOAL), never from the model, and is truncated with a marker rather than eating the budget it is meant to protect. The host now counts turns (sp_host_turn) so a plugin can schedule against them; that is what makes 'every five' mean five user turns and not five requests. Sidebar shows the goal and the reminder count. Fourteen test binaries green, test_focus drives the counter directly: turn 1 silent, turn 2 one reminder in the right position, a second compaction in the same turn adds none, turn 3 silent, turn 4 the second reminder.
71 KiB
Executable File
71 KiB
Executable File