Per-Agent Memory Compression Skill
Overview
This skill automates weekly memory consolidation for multi-agent OpenClaw deployments. It discovers all agents with workspaces and registers staggered cron tasks that compress old daily notes into long-term memory files.
Key Features
- - Auto-discovery: Finds all agents via INLINECODE0
- Workspace isolation: Each agent compresses its own memory
- State persistence: Tracks processed notes in INLINECODE1
- Deduplication: Avoids duplicate entries
- Domain awareness: Includes DOMAIN_CONTEXT for tailored extraction
- Zero config: Just run INLINECODE2
Installation
CODEBLOCK0
This creates 5 staggered tasks (if you have 5 agents) running Sundays 03:00-05:00 Shanghai time.
What It Does
- 1. Pre-check paths and initialize state
- List daily notes older than 7 days (skip recent)
- Sort oldest first, process up to 5 notes per run
- For each note:
- Read content
- Extract factual info (preferences, decisions, personal info)
- Append to target files with date headers
- Move original to
memory/processed/
- 5. Update state file
- Clean working buffer
- Send DingTalk summary
File Structure
Each agent workspace should have:
- -
memory/YYYY-MM-DD.md (daily notes) - INLINECODE5 ,
IDENTITY.md, SOUL.md, MEMORY.md (targets)
After running:
- -
memory/.compression_state.json (state tracking) - INLINECODE10 (moved old notes)
Customization
Edit install.sh to adjust:
- - Stagger offsets (
OFFSETS array) - Domain context per agent (
DOMAIN_CONTEXT associative array) - Cron expression (currently Sundays)
Troubleshooting
- - Task hangs: Check STATE_FILE path uses
{WORKSPACE} (uppercase), not INLINECODE15 - No notes processed: Ensure there are daily notes older than 7 days
- Timeout: Increase
--timeout in install.sh (default 1200s) - Delivery fails: Verify DingTalk connector configured with
to field
Uninstall
CODEBLOCK1
Removes all per_agent_compression_* tasks.
Version
Current: 1.3.4 (fixes STATE_FILE case sensitivity bug)
Support
See README.md for full documentation.
每智能体记忆压缩技能
概述
本技能为多智能体OpenClaw部署自动执行每周记忆整合。它会发现所有拥有工作空间的智能体,并注册错峰定时任务,将旧日记笔记压缩为长期记忆文件。
主要特性
- - 自动发现:通过openclaw agents list查找所有智能体
- 工作空间隔离:每个智能体压缩自身记忆
- 状态持久化:在.compressionstate.json中追踪已处理笔记
- 去重处理:避免重复条目
- 领域感知:包含DOMAINCONTEXT以实现定制化提取
- 零配置:只需运行./install.sh
安装
bash
cd /root/.openclaw/workspace/skills/per-agent-compression-universal
./install.sh
此操作将创建5个错峰任务(如果您有5个智能体),于上海时间周日03:00-05:00运行。
功能说明
- 1. 预检查路径并初始化状态
- 列出超过7天的日记笔记(跳过近期笔记)
- 按时间从旧到新排序,每次最多处理5条笔记
- 对每条笔记:
- 读取内容
- 提取事实信息(偏好、决策、个人信息)
- 追加到目标文件并添加日期标题
- 将原始文件移至memory/processed/
- 5. 更新状态文件
- 清理工作缓冲区
- 发送钉钉摘要
文件结构
每个智能体工作空间应包含:
- - memory/YYYY-MM-DD.md(日记笔记)
- USER.md、IDENTITY.md、SOUL.md、MEMORY.md(目标文件)
运行后:
- - memory/.compression_state.json(状态追踪)
- memory/processed/(已移动的旧笔记)
自定义配置
编辑install.sh以调整:
- - 错峰偏移量(OFFSETS数组)
- 每个智能体的领域上下文(DOMAIN_CONTEXT关联数组)
- Cron表达式(当前为周日)
故障排除
- - 任务挂起:检查STATE_FILE路径是否使用{WORKSPACE}(大写),而非{workspace}
- 未处理笔记:确保存在超过7天的日记笔记
- 超时:增加install.sh中的--timeout(默认1200秒)
- 投递失败:验证钉钉连接器是否配置了to字段
卸载
bash
./uninstall.sh
移除所有peragentcompression_*任务。
版本
当前版本:1.3.4(修复了STATE_FILE大小写敏感错误)
支持
完整文档请参见README.md。