agentleFS
kratoczkratocz/skills/skills/session-recall/SKILL.md

session-recall

Skill1 starsChanged 50 days agoMITView on GitHub

Find the transcript of an earlier agent session — by the `Claude-Session` trailer of a commit, by session UUID, or by topic — and recover what the USER said in it (their prompts verbatim, in order), which commits that session made, and what was said after its last commit and therefore may never have reached the repo. Use when the user says "/session-recall", "načti předchozí session", "dokázal bys načíst session, kde jsme…", "co jsme řešili minule", "víš, jak jsme se bavili o…", "recall the session where we…", "what did we discuss last time", "load the previous conversation about X". Not time tracking over transcripts — that is tracker-backfill / work-reconcile.

5 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

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

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

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

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

    By UUID: If the user or a note has it: $H/projects/<slug>/<uuid>.jsonl.

    line 65
  2. Very specific:

    When the current repo's slugs have no hit, widen the search to $H/projects/*/: the topic may have been discussed while the user worked in …

    line 74
  3. Very specific:

    Read the result as a timeline.

    line 109
  4. Very specific:

    If behind and the checkout is clean, git merge --ff-only origin/main and re-read the file.

    line 145

“Common” is measured: kept by at least 6 in 10 of the 4 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

Session Recall

A new session does not remember the last one, but the last one is on disk: every Claude Code session writes a JSONL transcript, and a commit made by a session carries its Claude-Session trailer. This skill turns "do you remember when we talked about X?" into a verified answer — the user's own words from that session, what landed in the repo, and what did not.

Two things this skill exists to prevent, both from the founding case (2026-09-24):

  • Confusing the artifact with the conversation. The repo document is the session's output; half the conversation can happen after the last commit (follow-up questions, decisions, corrections) and live only in the transcript.
  • Calling something "not in the repo" from a stale checkout. The founding session read a worktree 16 commits behind origin/main and told the user the document lacked things that upstream had carried for two weeks. Every claim about repo state goes through git fetch first (Step 5).

Steps

  1. Resolve the transcript directory. Transcripts live in <harness-home>/projects/<slug>/*.jsonl, where <harness-home> is ~/.claude (Claude Code) or ~/.gemini/antigravity-cli (Antigravity CLI) — use the first that exists — and <slug> is a working directory with / and . replaced by - (/Users/me/proj → -Users-me-proj). A repo with worktrees has one directory per worktree (…-proj--claude-worktrees-x); the session you want may sit under the main checkout's slug even if today's session runs in a worktree — list all slugs that share the repo prefix:

    H=~/.claude   # or ~/.gemini/antigravity-cli — the <harness-home> resolved above
    ls -d $H/projects/*<repo-name>* 2>/dev/null
    ls -lat $H/projects/<slug>/*.jsonl | head -20

    Filenames are session UUIDs with no date; the mtime is the session's last activity. Ignore <uuid>/subagents/*.jsonl unless the trail leads there.

  2. Find the session. Three routes, in order of reliability:

    • By commit. The trailer names the session:
      git log -1 --format='%(trailers:key=Claude-Session,valueonly)' <sha>
      grep -rl --include='*.jsonl' '<session-id-from-url>' $H/projects/<slug>*/
      The recursive form also reaches <uuid>/subagents/; spelling that out as a second glob aborts the whole command in zsh (no matches found) whenever one slug has no subagents. A hit under <uuid>/subagents/ belongs to the session <uuid>, not to a separate one. The id matches every transcript that ever displayed that commit — the session that wrote it, and any later session that ran git show or git log on it (today's included). The author is the file whose first user prompt predates the commit and whose mtime is after it; verify with Step 3's timestamps before trusting it.
    • By UUID. If the user or a note has it: $H/projects/<slug>/<uuid>.jsonl.
    • By topic. Count hits per file and rank; prefer distinctive words (a filename the session created, a proper noun) over common ones:

      for f in $H/projects/<slug>*/*.jsonl; do printf '%6d %s\n' "$(grep -c -i '<keyword>' "$f")" "$f"; done | sort -rn | head

      Then confirm with Step 3 — a high count can be a session that merely read the file the earlier session wrote.

      When the current repo's slugs have no hit, widen the search to $H/projects/*/: the topic may have been discussed while the user worked in another project. On 2026-11-06 a question asked in imperator had been settled three weeks earlier in a course repo's worktree. Across all projects, raw counts cannot tell the session that discussed the topic from the ones whose compaction summaries or pasted review diffs merely repeat the word. Rank by the user's typed prompts instead: run Step 3's filter on each file and keep the prompts that match the topic word and a second word, e.g. select($t|test("chatgpt";"i")) | select($t|test("voice|mcp|tmux";"i")). The user's own questions then show directly which session it was.

    Exclude the running session. In Claude Code its UUID is the second-to-last component of the scratchpad path in your system prompt; elsewhere it is the transcript under the current slug with the newest mtime.

  3. Extract what the user said — and only that. A transcript mixes the user's typed prompts with tool results, injected skill text, task notifications and local-command echoes, all under type: "user". The typed prompts are the entries whose message.content is a string (or an array made only of text items with no tool_result), minus the harness noise:

    F=$H/projects/<slug>/<uuid>.jsonl
    jq -r '
      select(.type=="user" and (.isMeta|not))
      | .message.content as $c
      | ( if ($c|type)=="string" then $c
          elif ($c|type)=="array" and ([$c[]|select(.type=="tool_result")]|length)==0
               then [$c[]|select(.type=="text")|.text]|join("\n")
          else empty end ) as $t
      | select($t|test("^<(task-notification|bash-input|bash-stdout|bash-stderr|local-command|command-name|command-message|command-args|system-reminder)")|not)
      | select($t|test("^Base directory for this skill")|not)
      | .timestamp + " || " + $t' "$F"

    Read the result as a timeline. Timestamps are UTC (Z); convert when the user reasons in local time. Keep the user's lines verbatim — they are the evidence, and paraphrase is where invented attribution starts.

    For the other side of the dialogue, take assistant text selectively — the last reply, or the reply after a specific prompt — never the whole file:

    jq -r 'select(.type=="assistant" and .timestamp > "<ISO>") | [.message.content[]?|select(.type=="text")|.text]|join(" ")' "$F" | grep -v '^$' | tail -3

    Transcripts can be megabytes; never cat one, and never send one to an external service — another model's CLI, a web tool, a tracker comment — as it may hold personal content, keys, and other people's messages. A read-only subagent on the same machine may read it, provided its brief gives it no web, network or other-provider tool and asks for fields, not quotations; if the harness runs subagents on a different provider than this session, read inline instead. Quote only what answers the question.

  4. Map the session onto the repo. Which commits did it make, and when did the last one land relative to the conversation?
    git log --format='%h %aI %s' --since='<first-prompt-ts>' --until='<mtime + 1h>'
    Split the user timeline at the last commit's time: before it is the work the repo reflects; after it is the part that may exist only in the transcript — follow-ups, corrections, preferences stated once the artifact was already committed. That second half is usually what the user is asking about without knowing it.
  5. Before saying "this never reached the repo", fetch. The checkout you are in — especially a worktree — can be far behind origin/main, and a later session may have absorbed exactly the after-commit conversation you found:
    git fetch origin && git rev-list --count HEAD..origin/main
    git log --format='%h %ad %s' --date=short HEAD..origin/main -- <file>
    If behind and the checkout is clean, git merge --ff-only origin/main and re-read the file. Only then compare the transcript's after-commit items against the current document, one by one.
  6. Report. Conclusion first:

    • which session (UUID, first–last timestamps, how you identified it, and what else matched and was rejected),
    • the user's prompts as a dated timeline (verbatim, trimmed to the relevant ones — say how many were omitted),
    • commits the session made,
    • what was said after the last commit and whether it is in the repo now — one line per item, checked against origin/main, marked in repo (sha) / not in repo / partly,
    • a next step, if one follows (update the document, ask the user the open question the session ended on).

    A statement about who said or decided what must point at a transcript line you read. If the transcript is silent, say so — do not fill the gap from the commit message.

Edge cases

  • Several transcripts match a commit — expected; the founding case had three (author, a subagent's subagents/*.jsonl, and the running session that had just run git show). Decide by timestamps (Step 2), and say which you rejected.
  • Session spanned a Došly tokeny / rate-limit pause — the transcript is still one file; long gaps between prompts are pauses, not session ends.
  • Session ran in a worktree whose directory is gone — the slug directory under $H/projects/ survives the worktree; search by repo prefix.
  • Content .message.content is an array of text items with no tool_result — that is a typed prompt with an attachment or pasted text; the filter above keeps it. An array with tool_result is a tool round-trip, not the user.
  • No transcript found — transcripts older than the retention period are deleted (seen 2026-11-13: none left from before mid-September, though cleanupPeriodDays now reads 365). Before calling the conversation lost, look where its traces outlive it:
    • <harness-home>/history.jsonl keeps the user's typed prompts with project and a millisecond timestamp, and reaches back further than the transcripts. The prompts name the topic, the day and the worktree.
    • The memory directories <harness-home>/projects/*/memory/ and the gitignored notes of the project the prompt names (docs.local/ and the like) hold what that session wrote down. On 2026-11-13 this recovered the reasons behind an assessment of a colleague from 2026-09-01 whose transcript was gone. Only the assistant's spoken answers are truly lost; say so, and offer the commit history as well.

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.