---
name: session-search
description: Search past session transcripts to recover prior work, conversations, and research context. Use when the user references something from a previous session, asks "what did we do before", or when you suspect relevant past context exists.
allowed-tools: Bash(grep:*), Bash(rg:*), Bash(ls:*)
---

# Session Search

Recover context from prior sessions by searching transcript stores. The session store path depends on the runtime.

## Session store locations

| Runtime | Transcript path |
|---|---|
| Claude Code | `~/.claude/projects/<hash-of-cwd>/*.jsonl` |
| OpenCode | `~/.local/share/opencode/session/` |
| Codex (Feynman host) | `~/.feynman/sessions/*.jsonl` |

Transcripts are typically JSONL — one JSON record per line with `type` (`session`, `message`, `tool_use`, `model_change`) and `message.content` fields.

## Direct search (works everywhere)

```bash
# keyword search across all transcripts
rg -l "scaling laws" ~/.claude/projects/
rg -l "scaling laws" ~/.local/share/opencode/session/

# fallback when ripgrep is not installed
grep -ril "scaling laws" ~/.claude/projects/
```

For structured queries against JSONL (e.g. "find all user messages about X"):

```bash
rg --json "query" ~/.claude/projects/ | jq 'select(.type == "match") | .data.path.text'
```

## Claude Code native

If the `session-logs` community skill is installed, it provides richer search over the current project's transcripts. Prefer it when available.

## OpenCode native

OpenCode stores sessions under `~/.local/share/opencode/session/<session-id>/`. List available sessions:

```bash
ls -lt ~/.local/share/opencode/session/ | head
```

Resume a past session with `opencode run -c <session-id>` (see OpenCode docs — subject to version).

## What to look for

- User messages referencing the same topic, paper, or codebase
- Assistant outputs (artifacts) that were saved to `outputs/`, `papers/`, or `notes/`
- Plan files (`outputs/.plans/<slug>.md`) that may still be valid
- Failed approaches — often more informative than the successful ones

## When to use

- User says "we talked about X before" or "remember the report on Y"
- Before starting research on a topic that feels familiar
- When resuming a paused workflow mid-project

## What NOT to do

- Do not inline large transcript dumps back into context — read and summarize, don't paste.
- Do not invent past conversations. If search returns nothing, say so instead of confabulating.
