Sessions

A session is the durable record of a run: an append-only entry log over a pluggable store. Kill the process, deploy, come back; the conversation continues from the same id.

store = Mistri::Stores::JSONL.new("tmp/sessions")
session = Mistri::Session.new(store:)
agent = Mistri.agent("claude-opus-4-8", session:)
agent.run("Start a haiku about the sea.")
# Later, in another process: reload by id and continue.
reloaded = Mistri::Session.new(store:, id: session.id)
Mistri.agent("claude-opus-4-8", session: reloaded)
.run("Now finish it.")

Stores

Three ship with the gem, and the interface is small enough to bring your own:

Mistri::Stores::Memory.new # in-process default
Mistri::Stores::JSONL.new("tmp/sessions") # one file per session
Mistri::Stores::ActiveRecord.new(AgentEntry) # your database

In Rails, generate the model first and name it whatever you like:

Terminal window
$ bin/rails generate mistri:install AgentEntry

Append-only on purpose

Entries are never rewritten. Approvals, denials, steers, and compaction summaries append to the log, which is what makes a run resumable from any process and your transcript views trustworthy.