session-history

Session 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.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "session-history" with this command: npx skills add maverick-software/session-history-enhancements

Session History

Transforms OpenClaw's single-slot session model into a multi-session history system with SQLite indexing, archive/restore, and full dashboard UI.

Architecture

~/.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:

  • On /new or session reset → old transcript moves to archive/, metadata indexed in SQLite
  • On archive (from UI) → session deactivated, transcript archived, indexed, removed from store
  • On resume → transcript moves back from archive/, SQLite status flips to active
  • Migration auto-runs on first access: indexes all orphaned .jsonl files

File Map

Backend (new files)

FileReferencePurpose
src/config/sessions/history-db.tsreferences/backend-history-db.ts.txtSQLite CRUD operations
src/config/sessions/history-migration.tsreferences/backend-history-migration.ts.txtOne-time migration + initHistoryDbWithMigration
src/gateway/session-archive.tsreferences/backend-session-archive.ts.txtArchive/restore logic

Backend (modified files)

FileReferencePurpose
src/gateway/protocol/schema/sessions.tsreferences/backend-protocol-schemas.ts.txtTypeBox schemas for new RPCs
src/gateway/server-methods/sessions.tsreferences/backend-rpc-handlers.ts.txt5 RPC handler implementations

Frontend (modified files)

FileReferencePurpose
ui/src/ui/controllers/sessions.tsreferences/frontend-controllers-sessions.ts.txtFull controller with archived session CRUD + pagination
ui/src/ui/views/sessions.tsreferences/frontend-views-sessions.ts.txtFull view with Session History section, Archive button, pagination
ui/src/ui/app-view-state.tsreferences/frontend-state-changes.txtState + app.ts + app-render.ts + app-chat.ts + app-settings.ts + app-render.helpers.ts wiring

Installation

See references/INSTALL.md for step-by-step instructions.

RPC Endpoints

MethodParamsPurpose
sessions.archivekeyArchive active session — deactivates, moves transcript, indexes in SQLite, removes from store
sessions.archivedagentId?, limit?, offset?, search?, status?List archived sessions with pagination and search
sessions.resumesessionId, agentId?Restore archived session to active
sessions.renamesessionId, displayName, agentId?Update session display name
sessions.deleteArchivedsessionId, agentId?, deleteTranscript?Delete archived session + optional transcript

UI Features

Sessions Page

  • Active Sessions grid — with Archive button (hidden for Main Session), History, Delete
  • Session History section — archived sessions with search, Resume/Rename/Delete buttons
  • Pagination — both sections have 10/20/25 page-size dropdown + Prev/Next

Chat Dropdown

  • Filters out cron/subagent/openai sessions (only user-facing sessions shown)
  • "Recent Sessions" <optgroup> with 10 most recent archived sessions
  • "📋 View All Sessions" link navigates to Sessions tab
  • Selecting an archived session auto-resumes it

Key Design Decisions

  • SQLite over JSON: Supports search, pagination, and indexing without loading everything into memory
  • Server-side pagination for archives: Pass limit/offset to sessions.archived RPC
  • Client-side pagination for live sessions: Slice the already-loaded array
  • sessionId-based dropdown values: Archived sessions all share the same sessionKey (agent:main:main), so the dropdown uses __archived__:{sessionId} as the option value
  • sessions.archive reuses sessions.delete param schema: Both need just { key }

Common Pitfalls

  1. RPC handler signature: Must use ({ params, respond }) destructuring, not (request, respond)
  2. assertValidParams: Takes 4 args: (params, validator, "method.name", respond)
  3. Sessions directory: Use resolveSessionTranscriptsDirForAgent(agentId) — NOT resolveGatewaySessionStoreTarget(config)
  4. Pagination on every load: All loadArchivedSessions calls must pass limit and offset
  5. Page reset: Changing page size or search query must reset page to 1
  6. Archived session dropdown filtering: Filter by sessionId, not sessionKey (all archived sessions share the same sessionKey)

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Leads

Leads - command-line tool for everyday use

Registry SourceRecently Updated
General

Bmi Calculator

BMI计算器。BMI计算、理想体重、健康计划、体重追踪、儿童BMI、结果解读。BMI calculator with ideal weight, health plan. BMI、体重、健康。

Registry SourceRecently Updated
General

Blood

Blood — a fast health & wellness tool. Log anything, find it later, export when needed.

Registry SourceRecently Updated
General

Better Genshin Impact

📦BetterGI · 更好的原神 - 自动拾取 | 自动剧情 | 全自动钓鱼(AI) | 全自动七圣召唤 | 自动伐木 | 自动刷本 | 自动采集/挖矿/锄地 | 一条龙 | 全连音游 - UI A better genshin impact, c#, auto-play-game, automatic, g...

Registry SourceRecently Updated