memory-backup

A tool for creating compressed backups of agent memory or chat history, listing saved snapshots, and restoring an earlier snapshot.

In plain words
What is it for?
Use it to make scheduled or manual backups, keep a chosen number of recent snapshots, view available backups, and restore one to a selected location.
Why use it?
It protects conversation or memory data from loss and provides a way to return to a previous saved state.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/leionion/clawforge/memory_backup
Any agent
npx skills add leionion/ClawForge --skill memory_backup
Clone the repo
git clone --depth 1 https://github.com/leionion/ClawForge

Made for: Claude Code, Codex.

Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 621 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00063 $0.00621
Opus 5 $0.00032 $0.00311
Sonnet 5 $0.00013 $0.00124
Haiku 4.5 $0.00006 $0.00062

Measured 2d ago against content hash f9525b08facd, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

memory-backup 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 2d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (memory_backup.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/04-Process/memory_backup/SKILL.md · 71 lines

How it starts

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

memory-backup — Agent Memory Backup & Restore

Creates compressed backups of agent memory/chat history and restores from previous snapshots. Supports configurable retention policies and scheduled execution via cron.

Usage

# Back up agent memory (default source: ~/.agent-memory)
python3 memory_backup.py backup

# Back up a custom source with retention of 5 snapshots
python3 memory_backup.py backup --source ~/my-memory --retention 5

# List all available backup points
python3 memory_backup.py list

# Restore from a specific backup
python3 memory_backup.py restore --restore-from ~/.agent-memory-backups/memory_backup_20240115_120000.tar.gz

Parameters

Flag Default Description
--source ~/.agent-memory Memory source directory or file
--backup-dir ~/.agent-memory-backups Where backups are stored
--retention 10 Keep N most recent backups (0 = keep all)
--restore-from Backup file path (required for restore)
--restore-to ~/.agent-memory Restore destination
--output json Output format (json or print)

Output examples

Backup:

{"status": "ok", "path": "/Users/you/.agent-memory-backups/memory_backup_20240115_120000.tar.gz", "retention": 10}

List:

{"backups": [{"path": "...", "name": "memory_backup_20240115_120000.tar.gz", "created": "2024-01-15T12:00:00"}], "count": 1}

Restore:

{"status": "ok", "restored_to": "/Users/you/.agent-memory"}

Scheduled backups (cron)

0 */6 * * * cd /path/to/skill && python3 memory_backup.py backup

Error handling

  • Source not found: returns {"error": "Source not found: <path>"}
  • Missing --restore-from: returns {"error": "--restore-from required for restore"}
  • Restore overwrites destination: existing files at restore target are replaced — back up first if uncertain
  • session-memory: the data source this skill backs up
  • calendar: trigger scheduled backups
  • file-organizer: manage backup files

Read the full file on GitHub · 71 lines

Files

What ships with it

2 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. 2d ago First seen · 71 lines · 63 tokens per session scan A f9525b08facd

Subscribe to this mod's changes

memory-backup is a skill published in the GitHub repository leionion/ClawForge (90 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 63 tokens to every session and 621 once invoked, about $0.0003 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-30.