session-recovery

session-recovery is a skill for Claude Code, Codex from Songhonglei/better-agent-skills. It costs 216 tokens per session (1,298 once invoked), scanned A, original, MIT.

A set of Python scripts for finding past coding-agent conversations and file changes in local session logs. It is designed for OpenClaw, an agent framework that stores sessions as JSONL files.

In plain words
What is it for?
Use it to search recent sessions by keyword, list file write and edit operations, search across agents, and extract recovered content.
Why use it?
It helps recover work when an agent session is lost or when you need to locate an earlier change without loading every log into memory.

Skill for Claude CodeCodex

Which agent this was written for is unclear — built for openclaw. Also seen: mentions Codex; built for openclaw.

Good fit Use it to search recent sessions by keyword, list file write and edit operations, search across agents, and extract recovered content.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/songhonglei/better-agent-skills/session-recovery
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Songhonglei/better-agent-skills --skill session-recovery
Clone the repo
git clone --depth 1 https://github.com/Songhonglei/better-agent-skills

Made for: Claude Code, Codex.

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-recovery

README.md
[![agentmods](https://agentmods.dev/badge/skills/songhonglei/better-agent-skills/session-recovery/github.svg)](https://agentmods.dev/skills/songhonglei/better-agent-skills/session-recovery)
Your own site
<a href="https://agentmods.dev/skills/songhonglei/better-agent-skills/session-recovery"><img src="https://agentmods.dev/badge/skills/songhonglei/better-agent-skills/session-recovery/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for session-recovery

Your own site · 80×15
<a href="https://agentmods.dev/skills/songhonglei/better-agent-skills/session-recovery"><img src="https://agentmods.dev/badge/skills/songhonglei/better-agent-skills/session-recovery.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 216 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,298 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00216 $0.01298
Opus 5 $0.00108 $0.00649
Sonnet 5 $0.00043 $0.00260
Haiku 4.5 $0.00022 $0.00130

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

Security

Grade A, and why

session-recovery scanned grade A with 0 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 11d ago.

The scan reads SKILL.md. This mod also ships 3 executable files (scripts/_common.py, scripts/extract.py, scripts/search.py), 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/session-recovery/SKILL.md · 131 lines

How it starts

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

session-recovery

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 --yes

Custom data root

If your OpenClaw install puts agents elsewhere, override:

Read the full file on GitHub · 131 lines

Files

What ships with it

5 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. 11d ago First seen · 131 lines · 216 tokens per session scan A a0e31ab17c8e

Subscribe to this mod's changes

session-recovery is a skill published in the GitHub repository Songhonglei/better-agent-skills (3 stars, last pushed 4d ago), licensed MIT. It adds 216 tokens to every session and 1,298 once invoked, about $0.0011 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.