Storage¶
Session persistence. See the Persistence guide for the on-disk layout.
SessionStore¶
SessionStore
¶
Persists session data to a directory on disk.
Layout:
<data_dir>/sessions/<session_id>/
traj.jsonl # incremental append-only event log
trajectory.json # full trajectory, overwritten after each turn
turns/
000_input.txt
000_raw_output.jsonl
Source code in caw/storage.py
write_metadata
¶
write_metadata(trajectory: Trajectory) -> None
finalize
¶
finalize(trajectory: Trajectory) -> None
append_turn
¶
append_turn(turn: Turn, trajectory: Trajectory, raw_output: str | None = None) -> None
Record a completed turn: event JSONL lines, trajectory snapshot, and raw files.
Source code in caw/storage.py
JsonlWriter¶
JsonlWriter
¶
Append-only JSONL writer with file locking for concurrent safety.
When subagent is set, every entry is tagged with "subagent": name
so readers can distinguish parent vs. subagent events.
Source code in caw/storage.py
append
¶
Append a single JSON object as one line (file-locked).
Source code in caw/storage.py
write_metadata
¶
write_metadata(trajectory: Trajectory) -> None
Write a metadata entry (typically once at session start).
Source code in caw/storage.py
write_turn_events
¶
write_turn_events(turn: Turn, turn_index: int) -> None
Write per-event JSONL lines for a completed turn.