Skip to main content

Module session

Module session 

Source
Expand description

Session files for production pause/resume.

A SessionFile captures enough agent state to resume a run that terminated abnormally (budget exceeded, stuck, transcript limit). It stores the goal, model, provider, a hash of the tool registry, the steps consumed so far, and the full transcript.

Sessions are written alongside transcripts when --session-out is set and the finish reason is non-success. They live under <workspace>/.recursive/sessions/ by convention.

Re-exports§

pub use crate::session_lock::SessionLock;
pub use crate::session_lock::SessionLockBusy;

Structs§

ExportedTranscript
A portable exported transcript for sharing and analysis.
OrphanToolCall
Goal-153: describes a tool call that was dispatched but never completed (no matching tool result message in the transcript).
SessionCost
Cumulative token cost for a session, stored in .meta.json.
SessionFile
A saved session that can be resumed.
SessionMeta
Metadata for a JSONL session.
SessionPersistenceSink
An EventSink that persists every AgentEvent::MessageAppended event to the session transcript file.
SessionReader
Reader for loading sessions from JSONL files.
SessionWriter
Writer for appending messages to a JSONL session file.
TranscriptEntry
A single JSONL line representing one message in the transcript.
TruncateStats
Stats returned by truncate_transcript_to_turn.
UsageMeta
Token usage for one or more LLM API calls, as reported by the provider.

Functions§

default_session_path
Default session output path for a given workspace. Returns ~/.recursive/workspaces/<ws-hash>/sessions/<timestamp>-<goal-prefix>.json.
entry_to_message
Convert a persisted TranscriptEntry into a runtime Message.
hash_tool_specs
Compute a BLAKE3 hash of the tool registry specs.
list_sessions
List all session files in a workspace’s session directory.
truncate_transcript_to_turn
Truncate transcript.jsonl (and the session’s .meta.json message_count) so that only the messages from turns 0..cutoff_turn survive.