The agent, run_agent.py and their helpers take a persistence handle instead of SessionDB. The store-side transcript repair moves beside the legacy store until the store is removed; agent/transcript_repair.py keeps the marker logic.
session_rules.turns is the one home of the message rules the agent shares with storage: the 56 agent functions whose bodies equal a session_rules.turns function are deleted, the agent and every other caller import them from session_rules.turns, and agent/message_content.py and agent/context_compressor_retry.py, left empty, go.