agentleFS
rhvdberghrhvdbergh/claude-skills/find-session/SKILL.md

find-session

Skill0 starsChanged 27 days agoMITView on GitHub

Search past Claude Code sessions by keyword and produce a resume command for the one you pick. Use when the user wants to find, recall, or resume an earlier session, or asks whether something was discussed before. Filters to the current repo by default.

11 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 4 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 8 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If the user passed no pattern, ask for one in plain text and stop until they answer.

    line 29
  2. Distinctive:

    Do not guess a pattern from the conversation.

    line 30
  3. Very specific:

    If the output is No matches for: <pattern>, tell the user, and suggest a shorter or less specific pattern.

    line 53
  4. Very specific:

    Default: keep only results whose cd path ends in /<repo>, or contains /<repo>/ (this keeps worktrees of the same repo).

    line 58
  5. Distinctive:

    If more than 4 results survive the filter, say how many there are, and suggest a narrower pattern.

    line 69
  6. Distinctive:

    Read the user's prompts from it to build the summary:

    line 80

“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “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

find-session

Find an earlier Claude Code session that mentions a pattern, then hand the user the command to resume it.

This skill wraps the claude-find script (~/.local/bin/claude-find, alias cf), which searches the JSONL session logs under ~/.claude/projects/.

You cannot resume a session yourself. claude --resume needs a fresh terminal. The skill ends by printing the command for the user to run.

Arguments

/find-session <pattern> [all]

  • <pattern> — a ripgrep regex, matched case-insensitively. Required.
  • all — skip the repo filter and search every project.

Steps

1. Get the pattern

If the user passed no pattern, ask for one in plain text and stop until they answer. Do not guess a pattern from the conversation.

2. Determine repo context

Run:

basename "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null || echo "no-repo"

Store the result as <repo>.

3. Search

Run:

claude-find "<pattern>" 25

Each result block holds a title, a cd <cwd>; claude --resume <id> line, and a snippet. Results are newest-first by session mtime.

If the output is No matches for: <pattern>, tell the user, and suggest a shorter or less specific pattern. Stop here.

4. Filter

  • Default: keep only results whose cd path ends in /<repo>, or contains /<repo>/ (this keeps worktrees of the same repo).
  • If the user passed all, or <repo> is no-repo: keep everything.
  • If the filter leaves zero results: say so, then show the unfiltered list instead.

5. Present options

Take the first 4 results. Use AskUserQuestion to let the user pick one. Label each option with the session title. Put the snippet in the option description, trimmed to one readable line — strip the JSON escaping so it reads as text.

If more than 4 results survive the filter, say how many there are, and suggest a narrower pattern.

6. Summarize the pick

The session file is ~/.claude/projects/<slug>/<id>.jsonl. Find it with:

ls ~/.claude/projects/*/<id>.jsonl

Read the user's prompts from it to build the summary:

jq -r 'select(.type=="user") | .message.content
       | if type=="string" then . else [.[] | select(.type=="text") | .text] | join(" ") end' \
   <file> 2>/dev/null | head -20

.message.content is a string on some records and an array of blocks on others, so the if branch is needed. The first entries are often slash-command scaffolding rather than the user's words — skip lines that start with <command or Base directory for this skill.

Give a 2–4 sentence summary: what the session was about, what was decided, and where it appeared to stop.

7. Print the resume command

End with the resume command on its own line, in a bash block, so the user can copy it:

cd <cwd>; claude --resume <id>

Tell the user to run it in a new terminal.

Notes

  • The search covers the raw session log, so it matches tool output and file contents, not only what the user typed. A common word returns noise. Prefer a distinctive term.
  • Claude Code deletes old session logs on a retention schedule. A session that this skill cannot find may already be gone.

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.