Scrape and analyze OpenClaw JSONL session logs to reconstruct and backfill agent memory files. Use when: (1) Memory appears incomplete after model switches, (2) Verifying memory coverage, (3) Reconstructing lost memory, (4) Automated daily memory sync via cron/heartbeat. Supports simple extraction and LLM-based narrative summaries with automatic secret sanitization.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install memory-sync或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install memory-sync⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/memory-sync/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: memory-sync description: > Scrape and analyze OpenClaw JSONL session logs to reconstruct and backfill agent memory files. Use when: (1) Memory appears incomplete after model switches, (2) Verifying memory coverage, (3) Reconstructing lost memory, (4) Automated daily memory sync via cron/heartbeat. Supports simple extraction and LLM-based narrative summaries with automatic secret sanitization. ---
Tool for maintaining agent memory continuity across model switches with automatic secret sanitization.
Requires Python 3.11+ and click:
pip install click
# Optional: for direct API summarization (only if not using OpenClaw backend)
pip install openai
# Run directly from skill directory
python ~/.openclaw/skills/memory-sync/memory_sync.py compare
# Or create an alias for convenience
alias memory-sync="python ~/.openclaw/skills/memory-sync/memory_sync.py"
# Check for gaps
memory-sync compare
# Backfill today's memory (simple extraction - fast, no LLM)
memory-sync backfill --today
# Backfill with LLM narrative (uses OpenClaw's native model - no API key needed)
memory-sync backfill --today --summarize
# Backfill all missing
memory-sync backfill --all
| Command | Description | |---------|-------------| | compare | Find gaps between session logs and memory files | | backfill --today | Generate memory for current day | | backfill --since YYYY-MM-DD | Backfill from date to present | | backfill --all | Backfill all missing dates | | backfill --incremental | Backfill only changed dates since last run | | extract | Extract conversations matching criteria | | summarize --date YYYY-MM-DD | Generate LLM summary for a single day | | transitions | List model transitions | | validate | Check memory files for consistency issues | | stats | Show coverage statistics |
The backfill command supports two modes:
Simple Extraction (default, without --summarize):
--preserve: Hand-written content is appended to the end of the new fileLLM Summarization (with --summarize) - Recommended:
--preserve: Existing content is passed to the LLM with instructions to incorporate it into the new summary, maintaining temporal order and thematic structureRecommended for regular use:
# Best quality: LLM summary that incorporates any existing notes
memory-sync backfill --today --summarize --preserve
Both modes automatically sanitize secrets before writing.
# Check what's missing
memory-sync compare
# Backfill everything (may take time)
memory-sync backfill --all
# Best: LLM summary that incorporates any existing notes
memory-sync backfill --today --summarize --preserve
# Smart: Process only days changed since last run
memory-sync backfill --incremental --summarize --preserve
# Or use a specific backend if preferred
memory-sync backfill --today --summarize --preserve --summarize-backend anthropic
# Backfill from last week to present
memory-sync backfill --since 2026-01-28 --summarize
# Keep hand-written notes when regenerating
memory-sync backfill --date 2026-02-05 --force --preserve --summarize
All content is automatically sanitized to prevent secret leakage:
Secrets are replaced with [REDACTED-TYPE] placeholders.
See SECRET_PATTERNS.md for complete pattern list.
The --summarize flag supports multiple backends via --summarize-backend:
| Backend | Description | API Key Required | |---------|-------------|------------------| | openclaw (default) | Uses OpenClaw's sessions spawn with your configured model | No | | anthropic | Direct Anthropic API via openai package | ANTHROPIC_API_KEY | | openai | Direct OpenAI API via openai package | OPENAI_API_KEY |
# Default: use OpenClaw's native model (no API key needed)
memory-sync backfill --today --summarize
# Explicit backend selection
memory-sync backfill --today --summarize --summarize-backend openclaw
memory-sync backfill --today --summarize --summarize-backend anthropic
memory-sync backfill --today --summarize --summarize-backend openai
# Override model for any backend
memory-sync backfill --today --summarize --model claude-sonnet-4-20250514
memory-sync backfill --today --summarize --summarize-backend openai --model gpt-4o
The openclaw backend is recommended as it:
Process today with LLM summary, preserving any existing notes:
0 3 * * * cd ~/.openclaw/skills/memory-sync && python memory_sync.py backfill --today --summarize --preserve >> ~/.memory-sync/cron.log 2>&1
Automatically detects changes since last run:
# Initial backfill (run once, simple extraction for speed)
python memory_sync.py backfill --all
# Then set up nightly incremental with LLM summaries
0 3 * * * cd ~/.openclaw/skills/memory-sync && python memory_sync.py backfill --incremental --summarize --preserve >> ~/.memory-sync/cron.log 2>&1
State is tracked in ~/.memory-sync/state.json.
Default paths:
~/.openclaw/agents/main/sessions/*.jsonl~/.openclaw/workspace/memory/Override with CLI flags:
--sessions-dir /path/to/sessions--memory-dir /path/to/memoryEnvironment variables (only for direct API backends):
ANTHROPIC_API_KEY - Required for --summarize-backend anthropicOPENAI_API_KEY - Required for --summarize-backend openaiThe default openclaw backend requires no API keys - it uses your OpenClaw configuration.
# Only needed if using direct API backends
export ANTHROPIC_API_KEY=sk-ant-...
export OPENAI_API_KEY=sk-...
The --preserve flag behavior depends on whether --summarize is used:
Without --summarize (simple extraction):
With --summarize (LLM mode):
Example:
# Regenerate with LLM, incorporating existing notes into the summary
memory-sync backfill --date 2026-02-05 --force --preserve --summarize
...
安装 Automated daily memory backfill for OpenClaw sessions 后,可以对 AI 说这些话来触发它
Help me get started with Automated daily memory backfill for OpenClaw sessions
Explains what Automated daily memory backfill for OpenClaw sessions does, walks through the setup, and runs a quick demo based on your current project
Use Automated daily memory backfill for OpenClaw sessions to scrape and analyze OpenClaw JSONL session logs to reconstruct and b...
Invokes Automated daily memory backfill for OpenClaw sessions with the right parameters and returns the result directly in the conversation
What can I do with Automated daily memory backfill for OpenClaw sessions in my documents & notes workflow?
将技能文件夹放到 ~/.claude/skills/memory-sync/ 目录(个人级,所有项目可用),或 .claude/skills/memory-sync/(项目级)。重启 AI 客户端后,用 /memory-sync 主动调用,或让 AI 根据上下文自动发现并使用。
Automated daily memory backfill for OpenClaw sessions 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Automated daily memory backfill for OpenClaw sessions 可免费安装使用。请查阅仓库了解许可证信息。
Scrape and analyze OpenClaw JSONL session logs to reconstruct and backfill agent memory files. Use when: (1) Memory appears incomplete after model switches, (2) Verifying memory coverage, (3) Reconstructing lost memory, (4) Automated daily memory sync via cron/heartbeat. Supports simple extraction and LLM-based narrative summaries with automatic secret sanitization.
Lists the top use cases for Automated daily memory backfill for OpenClaw sessions, with example commands for each scenario
Automate my documents & notes tasks using Automated daily memory backfill for OpenClaw sessions
Identifies repetitive steps in your workflow and sets up Automated daily memory backfill for OpenClaw sessions to handle them automatically
Automated daily memory backfill for OpenClaw sessions 属于「Documents & Notes」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。