/memory-toolkit:session-restore [backup|restore|list|search <query>]from memory-toolkit
Restores context from .jsonl session backups by parsing history, building a chronology, and saving key decisions to memory. Useful for resuming interrupted work or reviewing past sessions.
Ships in memory-toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Parses .jsonl files of Claude Code sessions, extracts chronology and key decisions.
~/.claude/projects/-<project-key>/
├── <UUID>.jsonl # current session (or completed)
├── <UUID>.jsonl.bak # backup before last compact
└── <UUID>/
└── subagents/ # subagent logs
/session-restore listShow all sessions with dates and sizes:
SESSIONS_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/projects/$(pwd | sed 's/[^a-zA-Z0-9]/-/g')"
ls -lat "$SESSIONS_DIR"/*.jsonl 2>/dev/null | head -20
Output a table: | File | Date | Size | .bak |
/session-restore restoreRestore context from the latest (or specified) session:
.jsonl, or by UUID from the argumentimport json, sys
path = sys.argv[1]
with open(path) as f:
lines = f.readlines()
for i, line in enumerate(lines):
try:
obj = json.loads(line.strip())
role = obj.get('role', '?')
msg_type = obj.get('type', '?')
c = obj.get('message', {}).get('content', obj.get('content', ''))
if isinstance(c, list):
for item in c:
if isinstance(item, dict):
tp = item.get('type', '')
if tp == 'text':
text = item.get('text', '').strip()
if role == '?' and msg_type == 'user':
if text and not text.startswith('<ide_') and not text.startswith('<system') and not text.startswith('<local-command') and not text.startswith('<command-') and len(text) > 5:
print(f'USER [{i}]: {text[:200]}')
elif role == '?' and msg_type == 'assistant':
if text and len(text) > 20:
print(f' CLAUDE [{i}]: {text.split(chr(10))[0][:200]}')
elif isinstance(c, str):
clean = c.strip()
if role == '?' and msg_type == 'user' and clean and not clean.startswith('<') and len(clean) > 3:
print(f'USER [{i}]: {clean[:200]}')
elif role == '?' and msg_type == 'assistant' and clean and len(clean) > 20:
print(f' CLAUDE [{i}]: {clean.split(chr(10))[0][:200]}')
except:
pass
## Session restoration <UUID>
Date: <file date>
Lines: <N>
### Block 1: <topic>
- <what was done>
- <key decisions>
### Block N: <topic>
- <what was done>
- **Last action:** <what was happening at the moment of termination/crash>
API Error — crash, specify the reasoncontext summary — compact, context was compressed/session-restore backupSave current session state to memory:
project_session_snapshot.md:---
name: Session snapshot
description: Session state snapshot as of <date>
type: project
---
## Task
<what we are doing>
## Done
- <list>
## In progress
- <current step>
## Remaining
- <list>
## Key decisions
- <decisions that affect further work>
/session-restore search <query>Search for a specific moment in session history:
.jsonl (or .jsonl.bak for pre-compact history)grep -i "<query>" "$SESSIONS_DIR"/*.jsonl | head -30
grep -n -i "<query>" <file> | head -10
# for each line number:
sed -n '<line-5>,<line+5>p' <file>
## Search: "<query>" in <file>
Found: N matches
### Match 1 (line N)
USER: <text>
CLAUDE: <text>
### Match 2 (line N)
...
.jsonl — check .jsonl.bak.bak exists — it contains the full history before compact, .jsonl may contain a compact summaryWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
10 skills in this plugin
/docs-reflectCollect DOC: notes from session, generalize, and propose repo documentation (.claude/rules/, docs/)./memoryProject memory — search, workstreams, notes, decisions. Auto-initializes on first use./memory-setupInitialize or upgrade project memory for memory-toolkit. Works with existing auto-memory./parkPark an idea, task or question for later — set it aside with its context, don't lose the thought.npx claudepluginhub ilyagorsky/memory-toolkit --plugin memory-toolkitOther plugins' skills for the same job