Install
openclaw skills install redis-memory-systemRedis-based cross-session memory system for OpenClaw agents. One-command setup, zero config. Automatically reads recent memory at session start (via bootstrap) and writes hourly summaries (via system cron). 7-day TTL, multi-user isolation via dual scripts. Use when agents need short-term memory that survives session resets without manual configuration, or when implementing multi-account memory isolation.
openclaw skills install redis-memory-system开箱即用。运行安装脚本后只需两步配置,自动读写 Redis。
chmod +x scripts/setup.sh
bash scripts/setup.sh
安装后自动:
$OPENCLAW_WORKSPACE/scripts/apt install redis-server -y
redis-server --daemonize yes
redis-cli PING # → PONG
openclaw cron add \
--name '记忆同步(兜底)' \
--schedule 'every 2h' \
-- \
bash /path/to/scripts/cron_memory_ping.sh
这个 cron 的作用:检测 draft:<用户>:summary 是否有未同步内容,如果有则升级为永久 Redis 摘要。
Heartbeat 在 OpenClaw Gateway 配置中:
gateway config set heartbeat.every "2h"
gateway config set heartbeat.target "last"
gateway config set heartbeat.isolatedSession false
gateway config set heartbeat.skipWhenBusy true
或者在 openclaw.json 中:
"heartbeat": {
"every": "2h",
"target": "last",
"isolatedSession": false,
"skipWhenBusy": true
}
我(对话中)→ draft key (12h TTL, EX 43200)
↓
系统 Cron(每小时) → 升级为永久 + 打卡
↓
OpenClaw Cron(每2h兜底)
↓
Heartbeat(每2h兜兜底)
↓
永久存储 memory:<用户>:YYYY-MM-DD(7天过期)
任意一层成功即保底。
Agent 在以下时机调用 draft 写入:
bash scripts/redis_memory.sh draft <用户> "<今天的完整摘要>"
触发时机:
redis-memory-system/
├── README.md # 快速说明
├── SKILL.md # 完整文档(本文件)
└── scripts/
├── setup.sh # 一键安装(Redis + cron + bootstrap)
├── redis_memory.sh # 通用版:get/set/draft/recent/action
└── redis_memory_isolated.sh # 隔离版(多账号防串读)
redis_memory_isolated.sh 通过 REDIS_MEMORY_USER 环境变量强制隔离