session-restore
Skill13 starsChanged 11 days agoMITView on GitHub
Context restoration from .jsonl session backups. Parses history, builds chronology, saves key decisions to memory.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- AhmedAbdelfattah0/AI-Skillstheir own version, first seen Nov 4, 2026
- anymasoft/1c-aitheir own version, first seen Jul 17, 2026
- Arman-Kudaibergenov/1c-ai-development-kittheir own version, first seen Mar 4, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- Arman-Kudaibergenov/1c-ai-development-kit★ 163same name
- AhmedAbdelfattah0/AI-Skills★ 4same name
- anymasoft/1c-ai★ 0same 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 repository9 other files it gives its agents.
- docs-reflectSkill
- memory-setupSkill
- memorySkill
- parkSkill
- reflectSkill
- session-continueSkill
- session-endSkill
- session-insightsSkill
- session-startSkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 3 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 106
Write to memory file project_session_snapshot.md:
- Distinctive: line 131
Update MEMORY.md if needed
- Distinctive: line 135
Search for a specific moment in session history:
- Distinctive: line 167
If there are many results (>10) — show the first 5 and ask "show more?"
- Very specific: line 168
If not found in .jsonl — check .jsonl.bak
- Very specific: line 174
If .bak exists — it contains the full history before compact, .jsonl may contain a compact summary
“Common” is measured: kept by at least 6 in 10 of the 3 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.
Files
Session Restore — backup and context restoration
Parses .jsonl files of Claude Code sessions, extracts chronology and key decisions.
Where data is stored
~/.claude/projects/-<project-key>/
├── <UUID>.jsonl # current session (or completed)
├── <UUID>.jsonl.bak # backup before last compact
└── <UUID>/
└── subagents/ # subagent logsCommands
/session-restore list
Show 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 -20Output a table: | File | Date | Size | .bak |
/session-restore restore
Restore context from the latest (or specified) session:
- Find the file — by default the most recent
.jsonl, or by UUID from the argument - Parse — extract USER and CLAUDE messages using python3:
import 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- Group into blocks — identify thematic blocks of the session (by topic changes)
- Show the user a brief chronology:
## 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>- Find the termination reason — check the last 20 lines:
API Error— crash, specify the reasoncontextsummary — compact, context was compressed- Normal termination — user closed the session
/session-restore backup
Save current session state to memory:
- Identify the current task (from todo, plan, or context)
- Write to memory file
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>- Update MEMORY.md if needed
/session-restore search <query>
Search for a specific moment in session history:
- Find the file — the most recent
.jsonl(or.jsonl.bakfor pre-compact history) - Grep — quick search through jsonl without full parsing:
grep -i "<query>" "$SESSIONS_DIR"/*.jsonl | head -30- Context — for each found fragment, show ±5 lines around it (to understand the topic):
grep -n -i "<query>" <file> | head -10
# for each line number:
sed -n '<line-5>,<line+5>p' <file>- Parse the results — extract text from JSON, filter out system messages
- Show the result:
## Search: "<query>" in <file>
Found: N matches
### Match 1 (line N)
USER: <text>
CLAUDE: <text>
### Match 2 (line N)
...- If there are many results (>10) — show the first 5 and ask "show more?"
- If not found in
.jsonl— check.jsonl.bak
Rules
- During restore DO NOT show system messages, ide_opened_file, tool calls — only USER and CLAUDE text
- Group by topics, not by lines — the user needs the big picture, not a log
- If
.bakexists — it contains the full history before compact,.jsonlmay contain a compact summary - During backup do not duplicate what is already in memory files — only save what is missing
- For large sessions (>10K lines) parse in chunks using offset
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
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.

