Skip to main content

should_autosave_origin

Function should_autosave_origin 

pub fn should_autosave_origin(origin: TurnOrigin) -> bool
Expand description

Whether a turn’s origin permits autosaving its user-side text as a Conversation memory.

Turn origin is trusted caller provenance, not proof that a person authored the text. Interactive, Channel, and AgentDirect remain autosave- eligible because each can carry user-facing or externally supplied text. On a scheduled turn (cron, heartbeat), however, the “user message” is an operator-configured task prompt, and on a sub-turn it is text the parent turn composed. Storing either as a user_msg row feeds known internal synthetic text back into recall.

This is the load-bearing gate; should_skip_autosave_content is a content-shape backstop for stored histories and origin-less surfaces. The content filter alone is defeatable — a heartbeat prompt with session context prepended no longer starts with [Heartbeat Task, and leaked that way in production — which is why suppression keys on origin first.

Exhaustive match on purpose: a new origin variant must decide its autosave posture here explicitly.