Steering

A run in flight can be redirected without killing it. steer appends a message to the session from any process; the loop folds it into the conversation at the next turn boundary.

Mistri::Session.new(store:, id: session_id)
.steer("Make the headline blue instead.")

A steer that arrives as the model finishes cleanly extends the run by one turn, so the message still gets answered instead of sitting unread in the log.

Rewriting context

transform_context runs over the message array before every provider call. What it returns is what goes on the wire; the session itself is never touched. Chain an array of callables for more than one:

keep_recent = ->(messages) { messages.last(50) }
agent = Mistri.agent("claude-opus-4-8", transform_context: keep_recent)

Reminders

Models drift from their instructions as turns accumulate. A reminder rides transform_context and folds a short line in at the tail of the context every few assistant turns, where attention is strongest:

agent = Mistri.agent("claude-opus-4-8", tools: tools,
transform_context: Mistri::Reminder.every(
3, "Stay on gifting. Verify with tools before claiming.",
))

It appears fresh on the wire each time it is due and never persists to the session.