.port_sessions/ in the working directory. These two commands let you persist a new session and reload an existing one.
flush-transcript
Persists and flushes a temporary session transcript.
Arguments
A prompt string to submit to the
QueryEnginePort before the transcript is persisted. This seeds the session with at least one message so the saved file is non-empty.What it does
- Builds a
QueryEnginePortfrom the current workspace. - Calls
engine.submit_message(prompt)to add the prompt to the session. - Calls
engine.persist_session(), which flushes theTranscriptStoreand writes a JSON file to.port_sessions/<session_id>.json. - Prints the path to the saved file and the flushed flag.
Output format
| Line | Description |
|---|---|
| Line 1 | Relative or absolute path to the saved session JSON file |
| Line 2 | flushed=True confirms the TranscriptStore was flushed successfully |
Session file format
The JSON file written to.port_sessions/ follows the StoredSession schema:
Example
The
session_id is a random UUID hex string generated when the QueryEnginePort is created. Copy it from the output path to use with load-session.load-session
Loads a previously persisted session by its session ID and prints a summary.
Arguments
The UUID hex string identifying the session. This must match the filename (without the
.json extension) in .port_sessions/.What it does
Reads.port_sessions/<session_id>.json, deserialises the StoredSession, and prints a three-line summary.
Output format
| Line | Description |
|---|---|
| Line 1 | The session ID |
| Line 2 | Number of stored messages (prompts) in the session |
| Line 3 | Token usage totals: input tokens and output tokens |
Example
When to use these commands
Useflush-transcript at the end of an exploration workflow to checkpoint your session before closing the terminal. Use load-session to verify that the file was written correctly and to inspect the token usage before deciding whether to restore the session in a future workflow.