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§
- Exported
Transcript - A portable exported transcript for sharing and analysis.
- Orphan
Tool Call - Goal-153: describes a tool call that was dispatched but never completed
(no matching
toolresult message in the transcript). - Session
Cost - Cumulative token cost for a session, stored in
.meta.json. - Session
File - A saved session that can be resumed.
- Session
Meta - Metadata for a JSONL session.
- Session
Persistence Sink - An
EventSinkthat persists everyAgentEvent::MessageAppendedevent to the session transcript file. - Session
Reader - Reader for loading sessions from JSONL files.
- Session
Writer - Writer for appending messages to a JSONL session file.
- Transcript
Entry - A single JSONL line representing one message in the transcript.
- Truncate
Stats - Stats returned by
truncate_transcript_to_turn. - Usage
Meta - 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
TranscriptEntryinto a runtimeMessage. - 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.jsonmessage_count) so that only the messages from turns0..cutoff_turnsurvive.