Terminal
Terminal/Skill
Searches and exports your local Cline session history by time, prompt, model, status, or workspace.
By Cline
Works with
npx skills add cline/skills --skill cline-session-historySearch and browse Cline session history stored on the local machine. Sessions live in ~/.cline/data/sessions/ as individual JSON metadata files and conversation transcript (.messages.json) files. Older sessions may also be in a sessions.db SQLite database.
The search script lives alongside this file at scripts/search_sessions.py, relative to the skill's own directory. Resolve it against the directory that contains this SKILL.md — not the current working directory — so it works regardless of where the command is run from.
Script path: scripts/search_sessions.py (relative to this skill's directory)
The examples below use scripts/search_sessions.py; prefix it with the skill directory's absolute path when running from elsewhere.
All filters are optional and combine with AND logic.
# Sessions from the last 10 minutes
python3 scripts/search_sessions.py --since 10m
# Sessions between two dates with "chatgpt" in the prompt
python3 scripts/search_sessions.py --since 2026-06-01 --until 2026-06-21 --prompt chatgpt
# Find a session by its starting prompt (quoted substring match)
python3 scripts/search_sessions.py --since 1d --prompt "find some code that should be improved" --full-prompt
# Non-interactive sessions that failed
python3 scripts/search_sessions.py --no-interactive --status failed
# VS Code extension sessions using Claude models, full prompts
python3 scripts/search_sessions.py --source vscode --model "claude" --full-prompt
# Full transcript of a specific session
python3 scripts/search_sessions.py --session-id 1781991507587_pozk0 --transcript
# Export matching sessions to a directory
python3 scripts/search_sessions.py --since 1d --export ~/tmp/exported-sessions
Both --since and --until accept:
10m, 30min, 2h, 1d, 1w (minutes, hours, days, weeks)2026-06-20, 2026-06-20T21:30:00Z, 2026-06-20T21:30:00+00:00| Filter | Description |
|---|---|
--since <time> | Sessions started after this time |
--until <time> | Sessions started before this time |
--prompt <text> | Case-insensitive substring search in prompt |
--prompt-regex <pattern> | Regex search in prompt (case-insensitive) |
--status <status> | running, idle, completed, cancelled, failed |
--source <source> | cli, vscode, etc. (exact match) |
--provider <name> | Provider name, exact match (e.g. cline) |
--model <text> | Model name substring, case-insensitive (e.g. claude) |
--mode <mode> | plan or act |
--cwd <path> | Working directory substring match |
--session-id <id> | Exact session ID lookup |
--interactive / --no-interactive | Filter by interactive flag |
--team-only / --no-team | Filter by team session flag |
--subagents / --no-subagents | Include/exclude subagent sessions |
| Option | Description |
|---|---|
--full-prompt | Show full prompt text instead of truncated |
--transcript | Print full conversation transcript |
--max-messages <n> | Limit messages in transcript output |
--content-types <types> | Comma-separated: text,thinking,tool_use,tool_result,image |
--export <dir> | Copy matching session files to a directory |
--limit <n> | Max number of sessions to return |
--json | Output as JSON |
| Option | Description |
|---|---|
--sessions-dir <path> | Custom sessions directory (default: ~/.cline/data/sessions) |
--db-path <path> | Custom sessions.db path |
--no-db | Skip SQLite DB, only scan JSON files |
--full-prompt or --transcript.--max-messages and --content-types to focus on relevant parts.--export <dir> to copy session files.Each session on disk has:
<session_id>.json — Metadata: session_id, started_at, status, source, provider, model, cwd, prompt, metadata (mode, systemPrompt, cost, usage), etc.<session_id>.messages.json — Full conversation transcript with messages containing content blocks (text, thinking, tool_use, tool_result, image).The SQLite sessions.db may contain older sessions with similar fields plus transcript_path, hook_path, parent_session_id, agent_id, is_subagent.