session-recover

session-recover is a skill for Claude Code from ngmeyer/skills. It costs 166 tokens per session (3,352 once invoked), scanned D, original, MIT.

A recovery tool for duplicate Claude Code project folders. It finds separate session and memory directories that represent the same project through different filesystem paths, then combines their memory and archives duplicate session records.

In plain words
What is it for?
Use it when sessions or memories are missing after opening the same project through different paths.
Why use it?
It restores access to lost-looking session history and project memory caused by changing or inconsistent working-directory paths.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Claude Code.

Not installable: its command points at a path on the author’s own machine, so it runs nowhere else. The line is /Users/me/.claude/projects/{ENCODED}/memory/.

Part of the ngmeyer-skills plugin — 10 skills shipped together

Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add ngmeyer/skills
Claude Code
/plugin install ngmeyer-skills

Made for: Claude Code.

Or install ngmeyer-skills, the plugin that ships this one along with the rest of its 10 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for session-recover

README.md
[![agentmods](https://agentmods.dev/badge/skills/ngmeyer/skills/session-recover.svg)](https://agentmods.dev/skills/ngmeyer/skills/session-recover)
Your own site
<a href="https://agentmods.dev/skills/ngmeyer/skills/session-recover"><img src="https://agentmods.dev/badge/skills/ngmeyer/skills/session-recover.svg" alt="Measured on agentmods" height="20"></a>
Per session 166 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,352 The whole file, excluding the scripts and references it only reads on demand.
Security scan D 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00166 $0.03352
Opus 5 $0.00083 $0.01676
Sonnet 5 $0.00033 $0.00670
Haiku 4.5 $0.00017 $0.00335

Measured 6d ago against content hash 7464f4314c7e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade D, and why

session-recover scanned grade D with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/inventory.sh), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

- You find two `~/.claude/projects/-*-foo/` directories whose trailing tokens match

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

4. **`rmdir "$LOSER"` failing:** usually a `.DS_Store` on macOS or a stray `todos/` dir. List the contents before retrying; don't `rm -rf` reflexively.
skills/engineering/session-recover/SKILL.md · 197 lines

How it starts

The opening of the file, as written. The whole thing — 197 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/session-recover — Manually merge duplicate Claude Code project directories

Claude Code stores per-project session transcripts and persistent memory under ~/.claude/projects/{encoded-cwd}/. The encoded cwd is the absolute path with every non-alphanumeric character replaced by -. Two different cwd paths that point at the same logical project (a real directory + its symlink mirror, an external-mount path + a ~/Projects/ shortcut, a Linux user moving from /home/me to /Users/me, etc.) produce two completely separate namespaces — separate session lists in /resume, separate memory dirs, no cross-visibility.

This skill cleans that up: detect the duplicates, unify the memory into the canonical location, archive the orphan transcripts, and capture the lesson so future sessions don't re-create the split.

When this skill applies

  • You opened a session and the memory dir is empty, but you remember adding entries in past sessions
  • claude --resume shows fewer sessions than you expect
  • You find two ~/.claude/projects/-*-foo/ directories whose trailing tokens match
  • Cross-session memory references in conversation don't resolve ([[some-memory]] links to nothing)
  • A grep for the project name across ~/.claude/projects/ returns multiple matches

If none of the above hold, the skill has nothing to do — exit early and tell the user.

Core principle

The canonical path is the one Claude Code's current system prompt tells you it is. When the harness starts a session it announces:

You have a persistent, file-based memory system at /Users/me/.claude/projects/{ENCODED}/memory/

That's the winner. Everything else with a similar trailing token is a loser candidate. The user can override if they actually want a different path canonical, but default to what the harness chose.

Procedure

Phase 1 — IDENTIFY: find duplicate project dirs

Use the optional argument as a project-name token. If omitted, infer from cwd's trailing component (basename "$PWD") or the conversation.

Read the full file on GitHub · 197 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 197 lines · 166 tokens per session scan D 7464f4314c7e

Subscribe to this mod's changes

session-recover is a skill published in the GitHub repository ngmeyer/skills (4 stars, last pushed 1mo ago), licensed MIT. It adds 166 tokens to every session and 3,352 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it D with 2 findings (reads agent configuration directories, recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

media-ingest

Ingest video, audio, PDF, book, screenshot, and GitHub repo content into the brain. Multi-format handling with entity extraction and backlink propagation. Covers video-ingest, youtube-ingest, and book-ingest subtypes.

garrytan/gbrain · 52 tokens

mem0-oss-to-platform

Plan and then execute a migration of a project from the mem0 open-source / self-hosted SDK (the local Memory class) to the mem0 Platform / hosted / managed SDK (the MemoryClient class). Use this whenever a developer wants to move, switch, or migrate their mem0 usage off OSS/self-hosted to the hosted API — e.g.…

mem0ai/mem0 · 273 tokens

Cortex

Operate Cortex, the LifeOS memory system — the typed Knowledge Archive (People, Companies, Ideas, Research with typed related: links) plus recall of prior work sessions, ISAs, and conversations. Search, add, harvest, develop, ingest, distill, graph-navigate, recall. USE WHEN cortex, knowledge, knowledge base, search…

danielmiessler/LifeOS · 196 tokens

memory

Use when the user asks to remember, recall, forget, update, search, or inspect durable OpenSquilla memory, including profile facts in USER.md and long-term notes in MEMORY.md or memory//.md.

opensquilla/opensquilla · 44 tokens

ha-data-stores

Map of Hope Agent's local data stores and safe read-only query workflow. Use when the user asks where Hope Agent stores data, wants to inspect sessions/messages/memory/logs/background jobs/knowledge indexes/settings, asks the model to query local app data, or debugging requires checking persisted state. Trigger…

shiwenwen/hope-agent · 115 tokens

establishing-project-context

Use when the user asks to establish shared project language, or project work exposes a conflicting, renamed, or deprecated domain term that needs active semantic modeling. Routine small tasks stay on the fast path.

GanyuanRan/Aegis · 45 tokens