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.
Split into sub-modules during the Goal 221 module refactor:
serialize—TranscriptEntry,entry_to_messagelifecycle—SessionLock,truncate_transcript_to_turnorphan—OrphanToolCallreader—SessionReaderwriter—SessionWriter,SessionPersistenceSink
Re-exports§
pub use lifecycle::truncate_transcript_to_turn;pub use lifecycle::SessionLock;pub use lifecycle::SessionLockBusy;pub use lifecycle::TruncateStats;pub use orphan::OrphanToolCall;pub use reader::SessionReader;pub use serialize::entry_to_message;pub use serialize::LoadedEntry;pub use serialize::TranscriptEntry;pub use writer::SessionPersistenceSink;pub use writer::SessionWriter;
Modules§
- lifecycle
- Session lifecycle operations: locking, truncation, and UUID chain recovery.
- orphan
- Orphan tool-call detection types (Goal 153).
- reader
- Session reader for loading transcripts and metadata from JSONL session files.
- serialize
- Transcript entry serialization types and conversion to runtime [
Message]s. - writer
- Session writer for appending messages to JSONL session files and
the
SessionPersistenceSinkevent-sink bridge.
Structs§
- Exported
Compact Boundary - A compaction boundary exported alongside
ExportedTranscript::messages. - Exported
Transcript - A portable exported transcript for sharing and analysis.
- 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.
- Usage
Meta - Token usage for one or more LLM API calls, as reported by the provider.
Enums§
- Session
Status - Status of a session. Persisted as a lowercase string.
Functions§
- default_
session_ path - Default session output path for a given workspace.
Returns
~/.recursive/workspaces/<ws-hash>/sessions/<timestamp>-<goal-prefix>.json. - hash_
tool_ specs - Compute a BLAKE3 hash of the tool registry specs.
- list_
sessions - List all session files in a workspace’s session directory.