session-recovery
Skill4 starsChanged 5 months agoMITView on GitHub
Recover lost agent session content and file changes from on-disk conversation logs. Streaming and OOM-safe on 700MB+ daily JSONL. Two commands: search.py for keyword search across recent sessions (with hit snippets, file-op listing, JSON for agent consumption); extract.py for pulling full write/edit content from a single session by ID prefix, with optional replay-rebuild for pure-edit sequences and safe restore-to-disk (refuses silent overwrites without --yes). Multi-agent aware via --agent main|all|a,b. Configurable data root via --root flag or SESSION_RECOVERY_ROOT env var (default ~/.openclaw/agents/). Trigger when user wants to find lost session content, recover files written by an agent, locate which session modified a file, search session history by keyword, or rebuild a file from an edit replay. Also triggers on 找回会话, 会话被覆盖, 历史会话搜索, 文件被删了, session 丢了, 找回某个文件, 重放编辑.
9 other projects use a version of this.
Adopted by
Most recently taken up by
- github/squadtheir own version, first seen Nov 8, 2026
- itgenius-au/skills-librarytheir own version, first seen Nov 1, 2026
- microsoft/fsi-banking-payments-dispute-resolution-acceleratortheir own version, first seen Oct 25, 2026
- microsoft/github-vteam-industry-demostheir own version, first seen Oct 25, 2026
- microsoft/wazatheir own version, first seen Oct 20, 2026
- kubefleet-dev/kubefleettheir own version, first seen Oct 8, 2026
Used with
Projects with it also use squad-commands, architectural-proposals and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
Microsoft AzureSkillsquad-commands
Categorized catalog of common Squad operations. Coordinator reads this file and presents it as an interactive menu when the user asks for available commands or help.
Also in 5 projects that use this
Microsoft AzureSkillarchitectural-proposals
How to write comprehensive architectural proposals that drive alignment before code is written
Also in 4 projects that use this
GitHubSkille2e-template-testing
End-to-end validation of coordinator and agent template changes
Also in 3 projects that use this
GitHubSkillnotification-routing
Route agent notifications to specific channels by type — prevent alert fatigue from single-channel flooding
Also in 3 projects that use this
- +7 more from Azure
- +1 more from github
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- github/gh-aw★ 5.6ksame name
- github/squad★ 3.4ksame name
- microsoft/waza★ 1.5ksame name
- Azure/fleet★ 227same name
- kubefleet-dev/kubefleet★ 164same name
- Azure/apiops-cli★ 32same name
- microsoft/github-vteam-industry-demos★ 2same name
- itgenius-au/skills-library★ 1same name
- microsoft/fsi-banking-payments-dispute-resolution-accelerator★ 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 repository16 other files it gives its agents.
- agent-avatar-managerSkill
- agent-team-meshSkill
- claw-memory-managerSkill
- codex-thread-repairSkill
- collective-memorySkill
- copy-my-profileSkill
- hello-envSkill
- init-hooksSkill
- multica-squad-load-balancerSkill
- multica-squad-onboardSkill
- openviking-projectsSkill
- recover-codex-project-chatsSkill
- rename-sessionSkill
- subagent-timeout-configSkill
- token-slimSkill
- workspace-git-setupSkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 82
If your OpenClaw install puts agents elsewhere, override:
“Common” is measured: kept by at least 6 in 10 of the 9 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-recovery
- Version: 1.0.2
- License: MIT
- Author: Evan Song · github.com/Songhonglei
- Repository: https://github.com/Songhonglei/better-agent-skills
Recover lost agent session content and file changes from on-disk conversation logs.
从本地会话日志中找回丢失的 agent 对话和文件改动。
Built for OpenClaw's on-disk session format (~/.openclaw/agents/<agent>/sessions/*.jsonl).
Streaming and OOM-safe for production-scale environments (5000+ sessions, 700MB+ daily JSONL).
Compatibility
| Platform | Status |
| OpenClaw | ✅ Full (primary target) |
| Other agent frameworks (CC / Codex / Hermes) | 🛣️ Roadmap |
| Linux | ✅ Full |
| macOS | ✅ Full |
| Windows (WSL) | ✅ Full |
| Python | ≥ 3.8 (uses pathlib, datetime.fromisoformat) |
Quick start
# Search recent sessions for a keyword
python3 scripts/search.py "index.html" --days 2
# Search by specific date, also list write/edit ops
python3 scripts/search.py "skill logo" --date 2026-06-13 --extract-files
# Search all agents
python3 scripts/search.py "anything" --agent all
# Filter by real msg timestamp (slower, more accurate when mtime lies)
python3 scripts/search.py "stuff" --days 7 --by-content-time
# JSON output for agent consumption
python3 scripts/search.py "stuff" --json
# Once you know the session ID, extract file ops
python3 scripts/extract.py 21f68359 --file-filter index.html
# Show full content (warning: can be large)
python3 scripts/extract.py 21f68359 --file-filter index.html --show-content
# Restore to original path (non-interactive needs --yes)
python3 scripts/extract.py 21f68359 --file-filter index.html --restore --yes
# Restore to a specific path
python3 scripts/extract.py 21f68359 --restore-to ~/out/index.html --yes
# Pure-edit session (no write baseline): replay edits to rebuild
python3 scripts/extract.py 21f68359 --file-filter app.py --rebuild \
--restore-to ~/out/app.py --yesCustom data root
If your OpenClaw install puts agents elsewhere, override:
# Per-call
python3 scripts/search.py "foo" --root /custom/openclaw/agents
# Or environment variable
export SESSION_RECOVERY_ROOT=/custom/openclaw/agents
python3 scripts/search.py "foo"Priority: --root > SESSION_RECOVERY_ROOT env > ~/.openclaw/agents/.
Data sources
Primary: JSONL conversations at <root>/<agent>/sessions/*.jsonl (always present).
Contains full tool calls, including write content and edit deltas.
Secondary (OpenClaw-specific): QMD archive at <root>/<agent>/qmd/sessions/*.md
(may not exist on all installs). Plain-text dialogue; survives session reset but
does NOT contain full code — use for finding which session, then extract from JSONL.
Recovery priority: non-reset JSONL > reset+QMD > QMD only > reset only.
Safety
- Restore refuses silent overwrites in non-TTY environments. You must pass
--yesto confirm in agent / CI / script contexts. - Target-already-exists is warned even with
--yes(writes are destructive). --show-contentprints full file content which may be huge — prefer--restore-tofor large files, or preview first.--max-files Nis an OOM guard (default 300). When hit, output explicitly flags "may have missed results"; narrow the time window or raise the limit.
Notes
- Session IDs support prefix match (first 8 hex chars usually enough).
- Time filter defaults to file
mtime, which can lie if a session was last modified hours after its content was written. Use--by-content-timefor accurate (slower) filtering by real message timestamps. --limitis per agent, per source. With--agent alltotal results multiply by agent count and source count.- Field-name compatibility built in:
write/editops accept any offile_path|path,content|new_string|newText,oldText|old_string,arguments|input|parameters.
License
MIT (see LICENSE)
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.

