session-recovery

session-recovery is an agent for Claude Code from Diablorosso67/multi-ai-memory. It costs 116 tokens per session (2,402 once invoked), scanned B, original, MIT.

A repair workflow for damaged Claude Code session transcripts. It finds a broken image or other file entry in a JSONL transcript—a text file containing one JSON record per line—and replaces it with a placeholder.

In plain words
What is it for?
Use it when a Claude Code session repeatedly reports a 400 image-processing error, to locate the affected transcript, back it up, and repair the problematic entry.
Why use it?
A damaged transcript can repeatedly cause an API error that prevents the session from accepting new messages. The workflow preserves a backup before repairing the selected session.

Agent for Claude Code

Written for Claude Code: a Claude Code subagent (agents/*.md). Also seen: model in frontmatter; reads .claude/ paths; 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 /home/user/code/.

Good fit Use it when a Claude Code session repeatedly reports a 400 image-processing error, to locate the affected transcript, back it up, and repair the problematic entry.

Compare 6 agents from other repositories ↓
Install

Getting it into your agent

There is no command for this one: it runs only inside a plugin, and the catalogue could not identify which plugin ships it. The source is linked below.

Made for: Claude Code.

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/agents/diablorosso67/multi-ai-memory/session-recovery/github.svg)](https://agentmods.dev/agents/diablorosso67/multi-ai-memory/session-recovery)
Your own site
<a href="https://agentmods.dev/agents/diablorosso67/multi-ai-memory/session-recovery"><img src="https://agentmods.dev/badge/agents/diablorosso67/multi-ai-memory/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/agents/diablorosso67/multi-ai-memory/session-recovery"><img src="https://agentmods.dev/badge/agents/diablorosso67/multi-ai-memory/session-recovery.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 116 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,402 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00116 $0.02402
Opus 5 $0.00058 $0.01201
Sonnet 5 $0.00023 $0.00480
Haiku 4.5 $0.00012 $0.00240

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

Security

Grade B, and why

session-recovery scanned grade B with 1 finding 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 8d ago.

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.

find ~/.claude/projects -name "*.jsonl" -not -name "*.backup-*" \
agents/session-recovery.md · 288 lines

How it starts

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

session-recovery — починка битых JSONL транскриптов Claude Code

Ты — хирург битых Claude Code сессий. Твоя задача — найти повреждённую картинку (или другой artifact) в .jsonl транскрипте и заменить на placeholder, чтобы сессия снова могла отправлять запросы в API без 400 ошибки.

Где живут транскрипты

~/.claude/projects/<sanitized-project-path>/<session-uuid>.jsonl

<sanitized-project-path> — путь проекта где работала сессия, заменены : \ на -. Например:

  • C:\my-workspace\projects\my-project\C--my-workspace-projects-my-project
  • C:\my-workspace\C--my-workspace
  • /home/user/code/-home-user-code

Workflow

Phase 1 — Найти сессию

Если user указал какой проект — иди в соответствующую папку. Если нет — ищи самые свежие .jsonl:

# Все сессии, отсортированные по mtime
find ~/.claude/projects -name "*.jsonl" -not -name "*.backup-*" \
  2>/dev/null | xargs ls -lt 2>/dev/null | head -20

# Также можно по имени проекта
ls ~/.claude/projects/ | grep -i "<keyword>"

Спроси user какая именно сессия если несколько кандидатов.

Phase 2 — Backup ОБЯЗАТЕЛЬНО

ПЕРЕД любыми правками:

JSONL=<path-to-target-jsonl>
cp "$JSONL" "${JSONL}.backup-$(date +%Y-%m-%d-%H%M%S)"
echo "Backup: ${JSONL}.backup-$(date +%Y-%m-%d-%H%M%S)"

Phase 3 — Diagnose

Найди битые image entries через Python:

import json
import base64
import sys, io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')

JSONL = '<path>'

PNG_SIG = b'\x89PNG\r\n\x1a\n'
JPEG_SOI = b'\xff\xd8\xff'

bad_lines = []
total_imgs = 0
errors = 0

with open(JSONL, 'r', encoding='utf-8') as f:
    for i, line in enumerate(f, 1):
        try:
            obj = json.loads(line)
        except json.JSONDecodeError as e:
            errors += 1
            print(f'JSON error line {i}: {e}')
            continue

        def walk(node):
            if isinstance(node, dict):
                if node.get('type') == 'image':
                    src = node.get('source', {})
                    data = src.get('data', '')
                    mtype = src.get('media_type', '')
                    if data:
                        # Try base64 decode + magic byte check
                        try:
                            decoded = base64.b64decode(data, validate=True)
                            if mtype == 'image/png' and not decoded.startswith(PNG_SIG):
                                yield ('bad_magic_png', i, data[:30])
                            elif mtype == 'image/jpeg' and not decoded.startswith(JPEG_SOI):
                                yield ('bad_magic_jpg', i, data[:30])
                        except Exception as e:
                            yield ('bad_b64', i, f'{e}: {data[:30]}')
                for v in node.values(): yield from walk(v)
            elif isinstance(node, list):
                for v in node: yield from walk(v)

        for issue in walk(obj):
            bad_lines.append(issue)
            total_imgs += 1

print(f'Issues: {len(bad_lines)}, JSON errors: {errors}')
for b in bad_lines[:20]:
    print(b)

Read the full file on GitHub · 288 lines

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. 8d ago First seen · 288 lines · 116 tokens per session scan B 0879a60bdc26

Subscribe to this mod's changes

session-recovery is an agent published in the GitHub repository Diablorosso67/multi-ai-memory (4 stars, last pushed 3mo ago), licensed MIT. It adds 116 tokens to every session and 2,402 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories

debugging-specialist

Systematic 4-phase debugging for complex and intermittent issues. Use when investigating bugs, tracking down race conditions, or diagnosing mysterious failures.

travisjneuman/.claude · 32 tokens

refactoring-specialist

Safe, incremental refactoring with comprehensive test coverage. Use when improving code structure, reducing complexity, or paying down technical debt.

travisjneuman/.claude · 30 tokens

performance-optimizer

Identifies performance bottlenecks and optimization opportunities. Use when investigating slow code, optimizing queries, or improving load times.

travisjneuman/.claude · 28 tokens

gsd-debugger

Investigates bugs using scientific method, manages debug sessions, handles checkpoints. Spawned by /gsd:debug orchestrator.

travisjneuman/.claude · 30 tokens

observability-engineer

OpenTelemetry, Prometheus, Grafana, distributed tracing, SLO design, and alerting specialist. Use when implementing observability, designing monitoring systems, or troubleshooting production issues. Trigger phrases: observability, monitoring, tracing, Prometheus, Grafana, OpenTelemetry, SLO, SLI, alerting, metrics…

travisjneuman/.claude · 82 tokens

go-expert

Go concurrency, error handling, stdlib patterns, Chi/Echo web frameworks specialist. Use when writing Go code, designing concurrent systems, or building Go web services. Trigger phrases: Go, Golang, goroutine, channel, Chi, Echo, stdlib, context, error handling, interface, module, go test.

travisjneuman/.claude · 69 tokens