~/.praisonai/sessions/.
How It Works
Quick Start
1
Persist with session_id
~/.praisonai/sessions/{session_id}.json.2
Use the store directly
Core Exports
SqliteSessionStore
SqliteSessionStore is a drop-in subclass of DefaultSessionStore that keeps JSON transcripts as the durable record and maintains a stdlib sqlite3 index alongside them. It gives you two indexed hot paths instead of directory scans:
- Cross-session search — FTS5 index of message content, used by
search()(Issue #2927). - Gateway/agent routing —
session_routeindex ofgateway_session_idandagent_id, used byget_by_gateway_session()andlist_sessions_by_gateway_agent()(Issue #2956).
Constructor
Behaviour
Fallback matrix
Sizing
- Each row in
session_ftsholds the flattened concatenation of a session’s message content (newline-joined). Large transcripts increase index size roughly linearly. - Use
":memory:"for ephemeral tests; use the default disk path for gateway bots that need durability across restarts.
Compaction Checkpoints
When context compaction runs during a conversation, the store can persist the summary so a later resume replays the compacted working history (summary + retained tail) instead of the full raw transcript. See Compacted Session Resume for the end-to-end agent flow.Store Methods
SessionData additions
SessionData.last_compaction holds the latest CompactionCheckpoint (or None). Two helpers support cheap resume:
set_chat_history() and clear_session() both clear last_compaction — replacing or clearing the transcript invalidates the anchor.Task-Local Context
Best Practices
Prefer session_id on Agent over manual store calls
Prefer session_id on Agent over manual store calls
Let
Agent(memory={"session_id": "..."}) handle persistence — use the store directly only for admin, migration, or custom backends.Use hierarchical store for forks and snapshots
Use hierarchical store for forks and snapshots
Switch to
get_hierarchical_session_store() when you need branching conversations or revert — see Session Hierarchy.Set task-local context in async workers
Set task-local context in async workers
Call
set_session_context() at the start of each async task so downstream code reads the correct session without threading IDs through every call.Related
Session Persistence
Agent-centric session_id usage
Session Hierarchy
Forking and snapshots
Cross-Session Recall
Search past sessions — anchored, demoted, deduped results

