Install
openclaw skills install session-history-enhancementsSession history system for OpenClaw — persistent, browsable, resumable chat sessions with SQLite index, archive/restore, migration, paginated UI, and chat dropdown integration. Use when: (1) adding session archival/indexing to OpenClaw, (2) implementing session browsing/search in the dashboard, (3) adding session resume/rename/delete, (4) archiving active sessions from the dashboard, (5) adding pagination to session lists, or (6) integrating recent sessions into the chat dropdown.
openclaw skills install session-history-enhancementsTransforms OpenClaw's single-slot session model into a multi-session history system with SQLite indexing, archive/restore, and full dashboard UI.
~/.openclaw/agents/{agentId}/sessions/
├── sessions.json # routing table (unchanged)
├── history.db # SQLite index (auto-created)
├── {activeSessionId}.jsonl # active transcript
└── archive/
└── {sessionId}.jsonl # archived transcripts
Lifecycle:
/new or session reset → old transcript moves to archive/, metadata indexed in SQLitearchive/, SQLite status flips to active.jsonl files| File | Reference | Purpose |
|---|---|---|
src/config/sessions/history-db.ts | references/backend-history-db.ts.txt | SQLite CRUD operations |
src/config/sessions/history-migration.ts | references/backend-history-migration.ts.txt | One-time migration + initHistoryDbWithMigration |
src/gateway/session-archive.ts | references/backend-session-archive.ts.txt | Archive/restore logic |
| File | Reference | Purpose |
|---|---|---|
src/gateway/protocol/schema/sessions.ts | references/backend-protocol-schemas.ts.txt | TypeBox schemas for new RPCs |
src/gateway/server-methods/sessions.ts | references/backend-rpc-handlers.ts.txt | 5 RPC handler implementations |
| File | Reference | Purpose |
|---|---|---|
ui/src/ui/controllers/sessions.ts | references/frontend-controllers-sessions.ts.txt | Full controller with archived session CRUD + pagination |
ui/src/ui/views/sessions.ts | references/frontend-views-sessions.ts.txt | Full view with Session History section, Archive button, pagination |
ui/src/ui/app-view-state.ts | references/frontend-state-changes.txt | State + app.ts + app-render.ts + app-chat.ts + app-settings.ts + app-render.helpers.ts wiring |
See references/INSTALL.md for step-by-step instructions.
| Method | Params | Purpose |
|---|---|---|
sessions.archive | key | Archive active session — deactivates, moves transcript, indexes in SQLite, removes from store |
sessions.archived | agentId?, limit?, offset?, search?, status? | List archived sessions with pagination and search |
sessions.resume | sessionId, agentId? | Restore archived session to active |
sessions.rename | sessionId, displayName, agentId? | Update session display name |
sessions.deleteArchived | sessionId, agentId?, deleteTranscript? | Delete archived session + optional transcript |
<optgroup> with 10 most recent archived sessionslimit/offset to sessions.archived RPCsessionKey (agent:main:main), so the dropdown uses __archived__:{sessionId} as the option valuesessions.archive reuses sessions.delete param schema: Both need just { key }({ params, respond }) destructuring, not (request, respond)(params, validator, "method.name", respond)resolveSessionTranscriptsDirForAgent(agentId) — NOT resolveGatewaySessionStoreTarget(config)loadArchivedSessions calls must pass limit and offset