Session management, persistence, and conversation history
SimpleClaw sessions store conversation history, context, and state for each agent interaction. Sessions are persisted to disk and cached in memory for fast access.
Transcript - Full conversation history with tool calls and responses
Delivery Context - Where to send replies (channel, thread, recipient)
Metadata - Created/updated timestamps, message counts, model usage
Model Overrides - Session-specific model preferences
// src/config/sessions/types.tsexport type SessionEntry = { key: string; // Session identifier agentId: string; // Which agent owns this session channel?: string; // Messaging channel lastChannel?: string; // Last active channel lastTo?: string; // Last recipient lastAccountId?: string; // Last bot account used lastThreadId?: string; // Last thread ID deliveryContext?: DeliveryContext; // Current delivery target createdAt?: string; // ISO timestamp updatedAt?: string; // ISO timestamp messageCount?: number; // Total messages in session model?: string | ModelConfig; // Model override origin?: Origin; // Original message context};
# List all sessionssimpleclaw sessions list# List sessions for specific agentsimpleclaw sessions list --agent main# Show detailed session infosimpleclaw sessions list --verbose
Delivery context determines where replies are sent:
export type DeliveryContext = { channel?: string; // "discord", "telegram", etc. to?: string; // Recipient ID accountId?: string; // Bot account to use threadId?: string; // Thread/conversation ID replyToId?: string; // Message ID to reply to};
Delivery context is updated automatically:
When messages arrive from new channels
When replying in threads
When switching between accounts
# Normalize and merge delivery contextdeliveryContext: channel: discord to: "123456789" accountId: default threadId: "thread-abc-123"
session: maintenance: mode: auto retention: maxAge: 90d # Delete sessions older than 90 days maxInactive: 30d # Delete sessions inactive for 30 days keepMinimum: 10 # Always keep at least 10 most recent sessions
{"role":"user","content":"Hello!","timestamp":"2026-03-03T10:00:00Z"}{"role":"assistant","content":"Hi! How can I help?","timestamp":"2026-03-03T10:00:02Z"}{"role":"user","content":"What's the weather?","timestamp":"2026-03-03T10:00:10Z"}{"role":"tool","tool":"web-search","args":{"query":"weather"},"timestamp":"2026-03-03T10:00:11Z"}{"role":"tool-result","result":"Sunny, 72°F","timestamp":"2026-03-03T10:00:12Z"}{"role":"assistant","content":"It's sunny and 72°F!","timestamp":"2026-03-03T10:00:13Z"}
Each line is a complete JSON object representing one message/event.