Overview & Purpose
Session Export serializes the active session context into structured JSON format to disk, allowing state persistence across tool calls or subagents.
When to Use
- State Persistence: Saving progress before long background operations.
- Hand-off to Subagents: Exporting context for sibling or child subagents.
Execution Workflow
- Gather Session Memory: Collect active thoughts, variables, and metadata.
- Execute Export Script: Call
scripts/session_export.py --file <path> --data <json_string>. - Verify File Creation: Confirm the JSON target file was created cleanly.
Expected Output Contract
### Session Export Complete
- **Target File**: [File Path]
- **Export Status**: [Success / Failed]
Scripts
scripts/session_export.py- Deterministic evaluation, state validation, and CLI tool for session-export.
Gotchas
- Ensure payload JSON is properly escaped when passed via command line flags.