agentleFS
yoshi47yoshi47/ai-conversation-search/skills/conversation-search/SKILL.md

conversation-search

Skill1 starsChanged 9 months agoMITView on GitHub

Find, review, and resume past AI coding conversations (Claude Code, OpenCode, Codex CLI) from their raw transcripts — returns the real session content, resumable session IDs, project paths, and the exact `claude --resume` command. Use whenever the user references a past session or prior conversation: to identify WHICH session something happened in, resume it, locate where a topic/PR/issue was discussed, or understand WHAT was discussed or decided earlier. The word "session"/"セッション" or any reference to a past conversation is the trigger — even when the user only wants the content, read the raw transcripts. A raw session UUID in the prompt ALWAYS triggers this skill — even when the transcript path looks obvious, and even when the session is only input to another task (verifying its conclusion, continuing its work); never find/grep ~/.claude/projects manually. Triggers: "find that conversation about X", "which session was that", "what did we discuss/decide", "resume that conversation", a session UUID, a GitHub PR/issue URL about past work. Japanese: "どのセッション", "過去のセッション(を確認/把握)して", "このセッションで調査してた <uuid>", "(そのセッションの)結論は合ってる/的を得てる?", "どこで話した/やった/確認した", "確認してた", "どんな内容/話だった(っけ)", "中身を把握", "~だっけ?", "あの会話", "あのPR/issue", "resume/続きやりたい".

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. johnhnguyen97/claude-code-config★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

25 rules. About 0 are common, 10 are distinctive, and 15 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 15

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    DO NOT use grep, find, cat, or any manual file operations on .jsonl files — this also bans parsing raw .jsonl with python3/json.loads/jq …

    line 26
  2. Distinctive:

    DO NOT skip the todo creation step when TodoWrite is available

    line 27
  3. Distinctive:

    DO NOT jump to Level 3 without attempting Levels 1 and 2

    line 28
  4. Very specific:

    ONLY use ai-conversation-search commands to *locate and read* conversations

    line 29
  5. Very specific:

    When you delegate past-session investigation to a subagent (Task tool), the subagent does NOT inherit these constraints — your delegating …

    line 30
  6. Distinctive:

    Decision rule: If the user mentions a session or a past/prior conversation in ANY form — including just wanting to *understand its content* …

    line 43
  7. Very specific:

    If the command is not found, the plugin may not be properly installed.

    line 78
  8. Very specific:

    Do not rely on a command being *rejected* to notice a stale binary: the envelope change rejects nothing.

    line 91
  9. Very specific:

    Action: Use list command with date filters

    line 110
  10. Very specific:

    Action: Use search "topic" command

    line 118
  11. Very specific:

    Action: Use search "topic" with date filters

    line 126
  12. Distinctive:

    If the prompt contains a session UUID — or any prefix of one of 8+ characters — you already know which conversation to read.

    line 134
  13. Very specific:

    No date filter on the first attempt: a --days 14 window silently drops older sessions (e.g.

    line 160
  14. Distinctive:

    Parse the JSON output: If you find relevant matches → skip to Level 4 (present results).

    line 170
  15. Very specific:

    Note: If results seem stale or incomplete, run ai-conversation-search index to update the index.

    line 172
  16. Very specific:

    If matches found but .truncated is true, re-run with a higher --limit before concluding anything is absent

    line 183
  17. Distinctive:

    Read message summaries to locate content

    line 198
  18. Very specific:

    Confirmation before launch (mandatory): never auto-start a session.

    line 227
  19. Very specific:

    Only after explicit confirmation, resume with the resume_command (or eval line).

    line 235
  20. Very specific:

    Every search/list --json row carries project_exists (bool, null when project_path is null) and project_basename (last path segment, for …

    line 314
  21. Distinctive:

    Read what the human actually said in one command:

    line 369
  22. Very specific:

    If no results → Level 2: ai-conversation-search search "auth bug" --group-by-session --limit 50 --json

    line 427
  23. Distinctive:

    Do not proceed until confirmed

    line 486
  24. Distinctive:

    Do not give up after Level 1

    line 494
  25. Distinctive:

    Only report "not found" after Level 3 fails

    line 495

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Conversation Search

Find past conversations across Claude Code, OpenCode, and Codex CLI and get the commands to resume them.

MANDATORY FIRST STEP - CREATE TODO CHECKLIST

Before doing ANYTHING else, you MUST use the TodoWrite tool to create this exact checklist: (If TodoWrite is not in this session's tool list — e.g. a subagent/background context — skip the checklist and go straight to Level 0/1; do not block on it.)

- Ensure ai-conversation-search tool is installed and upgraded
- Check for a session ID in the prompt (Level 0: read it directly, skip the rest)
- Classify query type (temporal/topic/hybrid)
- Execute Level 1: focused search with ai-conversation-search
- Execute Level 2: broader search if Level 1 fails
- Execute Level 3: manual exploration if Level 1 and 2 fail
- Present results to user

CRITICAL CONSTRAINTS:

  • DO NOT use grep, find, cat, or any manual file operations on .jsonl files — this also bans parsing raw .jsonl with python3/json.loads/jq (piping this tool's own --json is fine; see below)
  • DO NOT skip the todo creation step when TodoWrite is available
  • DO NOT jump to Level 3 without attempting Levels 1 and 2
  • ONLY use ai-conversation-search commands to locate and read conversations
  • When you delegate past-session investigation to a subagent (Task tool), the subagent does NOT inherit these constraints — your delegating prompt MUST tell it to use ai-conversation-search (give the invocation) and MUST NOT tell it to grep/find/read ~/.claude/projects or .jsonl files directly
  • Piping this tool's own --json output through jq is fine and expected — but reach for the built-in flags first (--role, --no-tools, --flat, --content-chars), which cover the common filters and return far less text

Mark each todo as in_progress when starting it, completed when done.

When to Use This Skill

This skill reads the raw .jsonl transcripts of past sessions and returns resumable session IDs, project paths, and the exact claude --resume command — the real conversation, not a reconstruction.

Decision rule: If the user mentions a session or a past/prior conversation in ANY form — including just wanting to understand its content — use this skill. Reading the actual transcript is the right move even when the user only wants to know "what was discussed", because the transcript is the source of truth.

User intentUse this skill
"Which session was that?" / "どのセッション?"✅
"Resume that conversation" / "続きやりたい"✅
"Check past sessions and tell me what it was about" / "過去のセッションを確認して把握して"✅
"What was discussed / decided in that session?" / "どんな内容/話だったっけ?"✅
User pastes a GitHub PR/issue URL and asks where it was discussed✅
Find a session by raw text (PR number, error message, exact phrase)✅
User gives a session UUID and asks to verify/continue that work / "このセッションで調査してた <uuid>、結論合ってる?"✅

A session UUID in the prompt is decisive even when it makes searching look unnecessary: do not find/grep ~/.claude/projects manually — read it with ai-conversation-search tree <SESSION_ID> (then context <MESSAGE_UUID> to expand around a specific message).

The presence of the word "session" / "セッション" or a reference to a past conversation is decisive — use this skill regardless of whether the user explicitly says "resume".

Prerequisites

In Claude Code, the ai-conversation-search CLI is automatically managed by the plugin wrapper. On first use, it downloads the correct binary for your platform and caches it.

First todo: Verify tool is available

ai-conversation-search --version

If the command is not found, the plugin may not be properly installed. Guide the user: reinstall the plugin or visit https://github.com/yoshi47/ai-conversation-search Outside Claude Code (Codex CLI, OpenCode) nothing puts the CLI on PATH — the user installs it per README "Manual Installation".

The reported version must be 0.16.0 or newer. Two things break below it. Before 0.15.0, --json returns a bare array instead of the {"results": [...]} envelope this skill assumes, so .results[] yields nothing and every search looks like "no matches" — a wrong answer, not an error. Before 0.16.0, the tree flags used throughout this skill (--role, --no-tools, --flat, --content) are rejected, and tree will not auto-index a session that just ended. Stop and tell the user to upgrade rather than reporting an empty result.

Do not rely on a command being rejected to notice a stale binary: the envelope change rejects nothing. Check command -v ai-conversation-search — a manually installed binary (e.g. in ~/.local/bin or ~/.cargo/bin) can shadow the plugin wrapper and will not auto-upgrade; refresh that binary or adjust PATH before trusting search results.

Do not proceed with search until the version check succeeds.

Query Type Classification

Second todo: Classify the user's query

Determine which type before executing search:

Type 1: Temporal Queries

User asks about time periods WITHOUT specific topics:

  • "What did we work on yesterday?"
  • "Summarize this week"
  • "Show today's conversations"

Action: Use list command with date filters

Type 2: Topic Queries

User asks about CONTENT/TOPICS:

  • "Find that Redis conversation"
  • "Where did we discuss authentication?"
  • "Show me where we worked on the API"

Action: Use search "topic" command

Type 3: Hybrid Queries

User asks about TOPIC + TIME:

  • "Show me yesterday's authentication work"
  • "Find Redis discussions from last week"
  • "How many times did you say X in the past week?"

Action: Use search "topic" with date filters

Search Workflow

Check Level 0 first. If it does not apply, execute Levels 1-3 in order without skipping.

Level 0: A Session ID Was Given (SKIP THE SEARCH ENTIRELY)

If the prompt contains a session UUID — or any prefix of one of 8+ characters — you already know which conversation to read. Searching for it is pointless; go straight to the transcript:

ai-conversation-search tree <SESSION_ID> --json --role user --no-tools --flat --content --content-chars 500

That returns just the human's messages, in order, with bodies. Drop --role user to see the assistant's replies too, and raise --content-chars when you need full text.

A session that just ended is fine. tree indexes the transcript on the spot when the id is not in the index yet, so there is no need to run index first — and no reason to conclude the session does not exist from a single not found.

Go to Level 4 with what you find.

Level 1: Focused Search (START HERE WHEN NO SESSION ID WAS GIVEN)

Based on query classification:

For Topic or Hybrid queries:

ai-conversation-search search "search terms" --group-by-session --limit 50 --json

No date filter on the first attempt: a --days 14 window silently drops older sessions (e.g. from months ago). Add --days/--date only when the user named an explicit date or range ("yesterday", "last week", "6/29"). Words like "昔/以前/あの" are the opposite signal — they mean widen the scope, not narrow it.

For Temporal queries:

ai-conversation-search list --date yesterday --json  # or --days N, --since, --until

Parse the JSON output. If you find relevant matches → skip to Level 4 (present results).

Note: If results seem stale or incomplete, run ai-conversation-search index to update the index.

Level 2: Broader Search

Only if Level 1 found nothing useful.

For topic/hybrid queries:

  • Level 1 is already unscoped in time, so widen by words, not by dates: try alternative keywords ("auth" vs "authentication"), broader terms ("database" vs "postgres"), or fewer terms (drop the least essential word — every extra word narrows the top of the ranking)
  • If matches found but .truncated is true, re-run with a higher --limit before concluding anything is absent

For temporal queries:

  • Expand time range: --days 30 instead of --days 7

If matches found → skip to Level 4.

Level 3: Manual Exploration

Only if Levels 1 and 2 both failed.

  1. List conversations: ai-conversation-search list --days 30 --json
  2. Review conversation summaries in JSON
  3. For promising sessions: ai-conversation-search tree <SESSION_ID> --json --no-tools --flat
  4. Read message summaries to locate content

Level 4: Present Results

Before asserting a match:

  • Confirm the candidate's context_snippet/content actually matches the query's concrete anchors (proper nouns, dates, PR/issue numbers, the described context). If the tie is weak, present it as "最有力候補" with a caveat, not as a confirmed hit.
  • State the search scope you used (--days/--repo/--date, or "全期間 (no filter)"). A narrow scope silently reported as exhaustive is how wrong sessions get presented as answers.

Format results for the user:

For found conversations (results include a source field: claude_code, opencode, or codex):

**Session Details**
- **Source**: Claude Code / OpenCode / Codex CLI
- **Session**: abc-123-session-id
- **Project**: /home/user/projects/myproject
- **Time**: 2025-11-13 22:50
- **Message**: def-456-message-uuid (if applicable)

**To Resume This Conversation**
```bash
cd /home/user/projects/myproject
claude --resume abc-123-session-id

Note: OpenCode sessions have `oc:` prefix, Codex sessions have `codex:` prefix in session IDs. For these sources, resume commands are tool-specific (not `claude --resume`).

**Confirmation before launch (mandatory):** never auto-start a session.
Present `preview` and `resume-spec`, then wait for the user:

```bash
ai-conversation-search preview <SESSION_ID> --messages 12 --query "<phrase>" --no-color
ai-conversation-search resume-spec <SESSION_ID> --json

Only after explicit confirmation, resume with the resume_command (or eval line). In a non-TTY agent shell, stop at presenting resume-spec — do not reach for eval on your own.

For counting/analysis queries:

  • Parse JSON results
  • Filter by message_type if needed (user vs assistant)
  • Count matches
  • Present clear answer with evidence

If not found after Levels 1-3:

  • "No matching conversations found after exhaustive search"
  • Suggest: ai-conversation-search index --days 90 to reindex older history
  • "The conversation may not exist or may be older than indexed range"

Command Reference

Reading --json output (two parse traps)

  • Pipe as ... --json 2>/dev/null | jq, never 2>&1. The CLI writes diagnostics (Note: showing first N results..., FTS/reindex notices) to stderr on purpose; folding them into stdout makes jq/json.loads fail with "Extra data".
  • Use the real field names — don't guess text/snippet/.messages[]. search rows are message-level: context_snippet (matched text; full_content with --content), message_type, timestamp, session_id, resume_command, source, project_path. list rows are conversation-level and have NO context_snippet/timestamp — instead conversation_summary, first_message_at/last_message_at, message_count, plus session_id/resume_command/source/project_path. Size output with --limit/--content-chars, never by truncating the stream (head -c before json.load corrupts it).

Search (for topic and hybrid queries)

# With time scope
ai-conversation-search search "query" --days N --json

# Specific date
ai-conversation-search search "query" --date yesterday --json
ai-conversation-search search "query" --date 2025-11-13 --json

# Date range
ai-conversation-search search "query" --since 2025-11-10 --until 2025-11-13 --json

# All time
ai-conversation-search search "query" --json

# Exact phrase match (prevents FTS5 operator injection)
ai-conversation-search search "query" --exact --json

# Group results by session (best match per session)
ai-conversation-search search "query" --group-by-session --json

# Hide hits on rewound-away branches (search keeps them by default with
# is_abandoned:true; tree marks them [rewound], preview shows current path only)
ai-conversation-search search "query" --active-only --json

# Show search diagnostics (session/message counts)
ai-conversation-search search "query" -v --json

# Filter by repository (partial match on repo root path)
ai-conversation-search search "query" --repo myproject --json

# Filter by source (claude_code, opencode, codex)
ai-conversation-search search "query" --source opencode --json

# Raise the result cap (default 20 — see below)
ai-conversation-search search "query" --limit 50 --json

Date filter options:

  • --days N: Last N days from now
  • --date DATE: Specific calendar day
  • --since DATE: From date onwards
  • --until DATE: Up to date (inclusive)
  • DATE formats: yyyy-mm-dd, yesterday, today
  • Cannot mix --days with --date/--since/--until

Other filter options:

  • --repo REPO: Filter by git repository root (partial match). Matches conversations from the same repo including worktrees and subdirectories.
  • --project PATH: Filter by working directory (exact match, search and list).
  • --here: Keep only sessions started at or under the current directory (prefix match, search and list).
  • --exclude-project STR / --exclude-repo STR: Drop rows whose working directory / repository root partially matches (repeatable, OR). Typical noise filter: --exclude-project observer --exclude-project /tmp. Both are ASCII case-insensitive, no path normalization.
  • --limit N: Max results (default: 20). Results are capped at this value. When the cap drops matches, a Note: showing first N results (more matches exist) line is printed to stderr — do not read a capped list as "nothing else exists". Raise it before concluding a topic is absent.
  • --content: Show fuller message content instead of the 200-character snippet. Works for human output, --group-by-session, and --json (which gains full_content and full_content_truncated per row). Capped at --content-chars (default 300) in both modes — raise it deliberately, since 50 uncapped bodies run to ~175KB of context.

Every search/list --json row carries project_exists (bool, null when project_path is null) and project_basename (last path segment, for telling worktrees apart). Skip rows with project_exists == false before presenting candidates: jq '.results | map(select(.project_exists != false))'.

List (for temporal queries)

ai-conversation-search list --date yesterday --json
ai-conversation-search list --days 7 --json
ai-conversation-search list --since 2025-11-10 --until today --json

# Filter by repository
ai-conversation-search list --days 7 --repo myproject --json

# Filter to the current directory and below
ai-conversation-search list --days 7 --here --json

# Filter by source
ai-conversation-search list --source codex --json

Like search, list is capped by --limit — the default cap can return only sessions newer than a target date and drop the older one you want. See the .truncated note below.

Status

# Check index health, coverage, and unindexed files
ai-conversation-search status --json

Context & Tree

ai-conversation-search context <MESSAGE_UUID> --json
ai-conversation-search tree <SESSION_ID> --json

# SESSION_ID accepts a full UUID or any unique prefix
ai-conversation-search tree 1c538017 --json

tree reports an error instead of guessing when a prefix matches more than one session; pass more characters to disambiguate. When the id resolves to nothing, tree indexes that session's transcript and retries once, so a conversation that ended moments ago is readable without running index.

The short prefix works for tree/context only. claude --resume does NOT resolve prefixes — always put the full session_id (UUID) from the tree/search result into the resume command.

tree options — use these instead of post-processing the tree yourself:

FlagEffect
--role user / --role assistantKeep only that side of the conversation
--no-toolsDrop [Tool: X] / [Tool result] / interrupt nodes, and empty bodies. Also drops the command text on [Tool: X] nodes and any message text that shares a node with a [Tool result] marker — skip this flag, or narrow with --role, when that text matters. (Tool output itself — bash stdout, fetched pages — is never indexed, so --no-tools is not why it's missing.)
--flatReturn a flat list instead of nested children, in timestamp order
--contentInclude message bodies (omitted by default)
--content-chars NCap each body at N characters (default 300)

Read what the human actually said in one command:

ai-conversation-search tree <SESSION_ID> --json --role user --no-tools --flat --content --content-chars 500

Filtering keeps total_messages at the session total and adds returned_messages for the count you got back. If a filter matches nothing, .warning says so — that is not the same as an empty conversation.

Bodies are opt-in on purpose: a long session serialises to hundreds of KB, which is worth avoiding unless you need the text. Nodes carry full_content_truncated so you can tell a capped body from a complete one.

Agent completion notices appear as user messages prefixed [Task notification] . They are often worth reading — that is where a subagent's findings live — but the prefix lets you skip them when you only want what the human typed.

Always use --json for structured output.

search, search --group-by-session and list return {"results": [...], "truncated": bool} — read rows from .results, and check .truncated. When it is true, --limit cut the answer off and "no match" is not a conclusion you can draw yet; re-run with a higher --limit. tree, context and status return their own objects, not this envelope.

Interactive Session Picker (requires fzf 0.28+ and jq)

Typing in the picker runs a live full-text search against message bodies via SQLite FTS5 (trigram tokenizer, Japanese/CJK friendly). Matching happens server-side on every keystroke, so the picker is not limited to titles/summaries.

# Browse recent sessions and filter by typing (searches titles + body)
ai-conversation-search pick

# Pre-fill the query at startup
ai-conversation-search pick "authentication bug"

# Scope to current directory (90-day window, up to 100 sessions)
ai-conversation-search pick --here

# Filter by project or time range
ai-conversation-search pick --days 30 --repo myproject

# Pick a session and execute the resume command
eval "$(ai-conversation-search pick)"

Examples

Example 1: Topic query

User: "Find that conversation where we fixed the authentication bug"

Todo workflow:

  1. ✓ Tool installed/upgraded
  2. ✓ Classify: TOPIC query
  3. ✓ Level 1: ai-conversation-search search "authentication bug" --group-by-session --limit 50 --json
  4. If no results → Level 2: ai-conversation-search search "auth bug" --group-by-session --limit 50 --json
  5. Present results with resume commands

Example 2: Temporal query

User: "What did we work on yesterday?"

Todo workflow:

  1. ✓ Tool installed/upgraded
  2. ✓ Classify: TEMPORAL query
  3. ✓ Level 1: ai-conversation-search list --date yesterday --json
  4. Parse conversations, group by project
  5. Present organized summary

Example 3: Hybrid query

User: "Show me yesterday's authentication work"

Todo workflow:

  1. ✓ Tool installed/upgraded
  2. ✓ Classify: HYBRID query (topic + time)
  3. ✓ Level 1: ai-conversation-search search "authentication" --date yesterday --json
  4. Present matching sessions

Example 4: Counting/analysis query

User: "How many times did you say 'absolutely right' in the past week?"

Todo workflow:

  1. ✓ Tool installed/upgraded
  2. ✓ Classify: HYBRID query (phrase + time)
  3. ✓ Level 1: ai-conversation-search search "absolutely right" --days 7 --json
  4. Parse JSON, filter message_type == "assistant", count results
  5. Present count with context snippets

Example 5: GitHub PR/Issue URL

User: "このPRのレビューしてたのってどのセッション? https://github.com/org/repo/pull/23064"

PR/Issue numbers appear verbatim in transcripts → high-precision FTS hit.

Todo workflow:

  1. ✓ Tool installed/upgraded
  2. ✓ Classify: TOPIC query (number is the search term)
  3. Extract the PR number from the URL (e.g. 23064)
  4. ✓ Level 1: ai-conversation-search search "23064" --json
  5. Present matching sessions with claude --resume commands

Stay with ai-conversation-search for this — manual grep over .jsonl files returns non-resumable results and misses the structured session metadata.

Error Handling

Tool not installed:

  • Guide user through installation (see Prerequisites section)
  • Do not proceed until confirmed

Database not found:

  • User must run: ai-conversation-search init
  • Creates ~/.conversation-search/index.db

Empty results:

  • Follow Level 1 → 2 → 3 progression
  • Do not give up after Level 1
  • Only report "not found" after Level 3 fails

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.