← Back to Skills Marketplace
justzerox

skill-heartbeat-memory

by ZeroX · GitHub ↗ · v0.0.7 · MIT-0
cross-platform ⚠ suspicious
241
Downloads
0
Stars
0
Active Installs
7
Versions
Install in OpenClaw
/install heartbeat-memory
Description
自动记忆保存 Skill。支持 Heartbeat 自动触发和主 Agent 中手动调用两种方式。自动检查新 sessions,生成 Daily 笔记,定期提炼 MEMORY.md,支持备份已删除的 sessions。
README (SKILL.md)

heartbeat-memory

🌐 ClawHub:​ clawhub.ai/JustZeroX/heartbeat-memory

💻 GitHub:​ github.com/JustZeroX/skill-heartbeat-memory

Heartbeat 自动记忆保存 - 支持 Heartbeat 自动触发手动触发 两种方式。自动检查新 sessions,使用 OpenClaw 主 LLM 生成/更新 daily 笔记,并定期提炼 MEMORY.md。

特点:​

  • ✅ 双模式支持 - Heartbeat 自动触发 + 主 Agent 中手动调用

  • ✅ 文件系统扫描 - 支持备份已删除的 sessions

  • ✅ 智能日期检测 - 自动检测最早 session 日期

  • ✅ 配置自动同步 - HEARTBEAT.md 自动更新

推荐安装位置:​ ~/.openclaw/skills/heartbeat-memory/(全局目录,所有工作区共享)

💡 路径说明:​ Skill 安装路径是全局的。运行时所有文件操作都相对于当前工作区根目录(./)。OpenClaw 在唤醒 Agent 时会自动将当前目录切换到该 Agent 的专属工作区,因此 ./ 始终指向正确的工作区。


🚀 快速开始

步骤 1:安装

方式 1:Via ClawHub(推荐 ⭐)​

# 1. 安装 ClawHub(如未安装)
npm install -g clawhub

# 2. 安装 heartbeat-memory
clawhub install heartbeat-memory

方式 2:Via GitHub

git clone https://github.com/JustZeroX/skill-heartbeat-memory.git ~/.openclaw/skills/heartbeat-memory

步骤 2:配置 Heartbeat

​⚠️ 重要:Heartbeat 默认是关闭的!​

方式 1:使用 CLI 命令(推荐)​

# 查看当前配置
openclaw config get agents.defaults.heartbeat

# 如未启用,编辑 openclaw.json 添加:"agents": { "defaults": { "heartbeat": { "every": "30m" } } }

# 重启 Gateway
openclaw gateway restart

方式 2:手动编辑 openclaw.json

{
  "agents": {
    "defaults": {
      "heartbeat": {
        "every": "30m"
      }
    }
  }
}

验证是否生效:​

openclaw config get agents.defaults.heartbeat
# 输出:{"every": "30m"} 表示已启用

步骤 3:使用

方式 1:自动触发(推荐 ⭐)​

安装并启用 Heartbeat 后,Skill 会每 30 分钟自动执行,无需手动干预。

方式 2:手动触发

在聊天中直接发送:

执行 heartbeat-memory

AI 会在主会话中直接执行,无需额外配置。


✨ 核心功能

1. 自动记忆保存

  • Heartbeat 触发:每 30 分钟自动执行

  • 智能扫描:检测新的 sessions + 活跃 sessions(有新内容的已处理 session)

  • 增量更新:对活跃 session 生成增量摘要,避免重复处理

  • 智能消息处理:动态调整处理数量(8-20 条),优先用户消息(70%)

  • LLM 提炼:生成结构化 Daily 笔记

  • 状态追踪:记录每个 session 的最后处理位置,避免重复处理

2. Daily 笔记生成

输出位置:​ ./memory/daily/YYYY-MM-DD.md

💡 路径说明:​ 所有路径都是相对于当前工作区的根目录(./)。OpenClaw 运行时会自动切换 CWD 到当前 Agent 的工作区,因此无需手动指定工作区路径。

内容包含:​

  • 当日总结(会话数、活跃度)

  • 会话详情(标题、摘要、标签)

  • 关键决策/发现

3. MEMORY.md 定期提炼

  • 默认频率:每周日 20:00

  • 自动提炼:从 Daily 笔记提取长期记忆

  • 可配置:支持自定义频率和时间

4. 自动初始化

首次运行时会自动:

  1. ✅ 创建配置文件

  2. ✅ 初始化状态文件

  3. ✅ 创建必要目录

  4. 自动检测 processSessionsAfter 日期

  5. 自动同步 HEARTBEAT.md 配置状态


📝 HEARTBEAT.md 自动同步

Skill 会自动维护 HEARTBEAT.md 中的"记忆自动保存"部分:​

  • 自动检测配置变更(通过 hash 对比)

  • 仅配置变更时更新(避免重复写入)

  • 动态路径展示(自动适配多 workspace)

  • 保留用户自定义内容(天气检查等不受影响)

示例:​

# HEARTBEAT.md - 心跳任务

## 🧠 记忆自动保存

\x3C!-- 此部分由 heartbeat-memory skill 自动维护,请勿手动修改 -->

- [x] 启用 heartbeat-memory Skill

- [x] 工作区:workspace(示例值,实际显示当前工作区名称)

- [x] 配置:处理 2026-03-06 之后的 sessions

- [x] 配置:每次最多处理 20 个 sessions

- [x] 配置:超时时间 1000 秒

**执行方式:​** Heartbeat 触发时自动执行 heartbeat-memory Skill

**配置文件:​** `./memory/heartbeat-memory-config.json`

**输出位置:​**

- Daily 笔记:`./memory/daily/YYYY-MM-DD.md`

- 长期记忆:`./MEMORY.md`

- 状态文件:`./memory/heartbeat-state.json`

⚙️ 核心配置

单工作区模式

编辑 ./memory/heartbeat-memory-config.json

多工作区模式

每个工作区有独立的配置文件:​

💡 重要说明:​ 由于 OpenClaw 在运行时会自动将当前工作目录(CWD)切换到对应 Agent 的工作区,因此所有工作区的配置文件路径写法完全相同,均为 ./memory/heartbeat-memory-config.json。Skill 会自动识别当前所属工作区,无需手动指定。

工作区 配置文件路径(运行时) 实际物理路径(从外部访问)
主工作区(workspace) ./memory/heartbeat-memory-config.json ~/.openclaw/workspace/memory/heartbeat-memory-config.json
开发工作区(workspace-dev) ./memory/heartbeat-memory-config.json ~/.openclaw/workspace-dev/memory/heartbeat-memory-config.json
测试工作区(workspace-test) ./memory/heartbeat-memory-config.json ~/.openclaw/workspace-test/memory/heartbeat-memory-config.json

自动检测:​ Skill 会自动识别当前所属工作区,无需手动指定。

详见:​ references/config.md

配置项 说明 默认值 建议值
enabled 是否启用 true true
batchSize 每批处理数 5 5-10
timeoutSeconds LLM 超时(秒) 1000 600-1500
maxSessionsPerRun 单次最多处理数 50 20-50
processSessionsAfter 只处理此日期后 自动检测 ISO 日期

完整配置说明:​ 详见 references/config.md


📋 配置示例

基础配置(默认)

{
  "memorySave": {
    "enabled": true
  }
}

首次运行(避免大量历史)

💡 提示:​ 首次运行时,Skill 会自动检测最早的 session 日期或 workspace 创建日期,并自动保存到配置文件。

{
  "memorySave": {
    "enabled": true,
    "processSessionsAfter": "2026-03-01T00:00:00Z",
    "maxSessionsPerRun": 20
  }
}

大量 sessions(分批处理)

{
  "memorySave": {
    "enabled": true,
    "maxSessionsPerRun": 30,
    "timeoutSeconds": 1500,
    "batchSize": 5
  }
}

更多示例:​ 详见 references/config.md


📊 处理策略

sessions 数量 策略 预计耗时
\x3C5 个 直接处理 \x3C2 分钟
5-10 个 分批处理 2-5 分钟
>10 个 启动 subagent 5-10 分钟

处理流程:​

Heartbeat 触发
    ↓
sessions_list 获取会话列表
    ↓
sessions_history 获取消息内容
    ↓
sessions_spawn 启动 subagent 进行 LLM 提炼
    ↓
写入 Daily 笔记
    ↓
检查是否需要提炼 MEMORY.md
    ↓
发送完成通知

❓ 常见问题

Q: 如何手动触发?

A: 在聊天中发送:"执行 heartbeat-memory"

Q: 为什么不能用 require 调用?

A: run() 依赖工具注入(sessions_list 等),只有 Heartbeat 自动触发或主 Agent 会话中工具才可用。

Q: 可以修改提炼频率吗?

A: 可以,编辑配置文件:

{
  "refineSchedule": {
    "type": "weekly",
    "dayOfWeek": "sunday",
    "time": "20:00"
  }
}

Q: 如何处理大量 sessions?

A: 自动分批处理,每次最多 50 个,剩余下次继续。也可手动限制:

{
  "maxSessionsPerRun": 20
}

Q: 通知未发送怎么办?

A: 检查 notifyTarget 配置,或删除该字段让 Skill 自动获取当前用户。

更多问题:​ 详见 references/troubleshooting.md


🔧 故障排查速查

Skill 不执行

# 1. 检查 Heartbeat 配置
openclaw config get agents.defaults.heartbeat
# 输出 {"every": "30m"} 表示已启用

# 2. 如未启用,编辑 openclaw.json 添加:
# "agents": { "defaults": { "heartbeat": { "every": "30m" } } }

# 3. 重启 Gateway
openclaw gateway restart

# 4. 重建配置文件(相对于当前工作区)
rm ./memory/heartbeat-memory-config.json

💡 路径说明:​ 故障排查命令中的路径都是相对于当前工作区(./)。在工作区目录下执行即可,无需指定完整路径。

HEARTBEAT.md 未更新

# 删除 configHash(强制重新同步)
# 编辑 heartbeat-state.json,删除 "configHash" 字段

处理速度慢

{
  "memorySave": {
    "maxSessionsPerRun": 20,
    "timeoutSeconds": 1500
  }
}

完整故障排查:​ 详见 references/troubleshooting.md


📖 参考文档

文档 说明
references/config.md 完整配置说明和示例
references/troubleshooting.md 故障排查指南
references/api.md API 字段详解

🎯 最佳实践

首次运行

  1. 不设置 processSessionsAfter(自动检测)
  2. 设置 maxSessionsPerRun: 20
  3. 观察执行日志

日常使用

  1. 保持默认配置
  2. 定期查看 Daily 笔记
  3. 根据需要调整提炼频率

性能优化

  • 大量 sessions:maxSessionsPerRun: 30, timeoutSeconds: 1500
  • 频繁触发:禁用 OK 通知(在 openclaw.json 中配置)
  • 内存优化:batchSize: 3, maxSessionsPerRun: 10

最后更新:2026-03-27

Usage Guidance
What to consider before installing: 1) Review the repository files locally before install. Inspect SKILL.md, scripts/post-install.js, index.js, and utils/*.js for any unexpected URLs, encoded blobs, or obfuscated strings (there are base64/unicode-control indicators in the doc). Remove/clean any hidden characters in SKILL.md. 2) Least privilege: install and test in a disposable or non-production profile/workspace first (or a VM/container) so the skill's filesystem writes (HEARTBEAT.md, ./memory/, MEMORY.md, heartbeat-state.json) don't affect important data. 3) Verify secrets and environment variables: the code probes for multiple LLM API keys even though none are declared in the registry. Ensure you do not have unrelated credentials in your environment that the skill would reuse inadvertently. Prefer running with only the credentials you intend the skill to use. 4) Post-install script: if you install via npm, scripts/post-install.js will run. Read that file and consider running it manually (or not at all) rather than allowing an automated postinstall if you want control over what it writes. 5) Disable automatic heartbeat until you're confident: Heartbeat is disabled by default but SKILL.md recommends enabling it. Keep memorySave.enabled=false or configure processSessionsAfter and maxSessionsPerRun conservatively before enabling automated runs. 6) Notifications and external channels: if you configure notifyTarget (feishu/wechat/telegram), know that the skill can send notifications to external channels configured by you — ensure channel credentials/IDs are correct and that you intend to expose summaries externally. 7) If you are unsure, request the upstream GitHub repo (the SKILL.md references github.com/JustZeroX/skill-heartbeat-memory) and confirm commit history and maintainers. A public, well-reviewed repo increases trust. If you want, I can: (a) point out specific lines in the files that reference env vars, shell execution, or file paths; (b) extract and show any base64 or hidden characters found in SKILL.md for inspection; or (c) suggest a safe minimal configuration to test the skill in a disposable workspace.
Capability Analysis
Type: OpenClaw Skill Name: heartbeat-memory Version: 0.0.7 The heartbeat-memory skill is a legitimate utility designed to automate session summarization and long-term memory management within the OpenClaw ecosystem. It utilizes standard platform tools (sessions_list, sessions_history, and sessions_spawn) to generate daily notes and refine a MEMORY.md file. The code is well-structured, modularized across several utility files (e.g., memory-refiner.js, session-filters.js), and includes robust logic for workspace detection and incremental updates. No evidence of data exfiltration, malicious command execution, or harmful prompt injection was found; all file operations are restricted to the user's local OpenClaw workspace.
Capability Tags
crypto
Capability Assessment
Purpose & Capability
The name/description (heartbeat-triggered memory saving, daily notes, MEMORY.md refinement) align with the code and docs: index.js, utils/* implement workspace detection, session filtering, incremental summaries and file writes. However, the package contains a post-install script and code that probes several environment variables (OPENAI_API_KEY, ANTHROPIC_API_KEY, DEEPSEEK_API_KEY, etc.) yet the registry metadata lists no required env vars — a mild mismatch worth noting.
Instruction Scope
Runtime instructions and the code instruct the skill to read many files under the user's home (~/.openclaw/openclaw.json, workspace directories, AGENTS.md, SOUL.md), scan session transcripts and gateway logs, and create/modify HEARTBEAT.md, ./memory/*, and state/config JSON files. That file I/O is consistent with the feature set, but the scope is broad (reads other workspaces, gateway logs and sessions files), and SKILL.md contains detected prompt-injection patterns (base64/unicode-control) — indicating the documentation itself may include obfuscated content or manipulation attempts. The skill will also run shell commands (execSync('openclaw agents list')), which is expected for workspace discovery but is a runtime capability with risk if executed in unexpected environments.
Install Mechanism
Registry shows no install spec (instruction-only), but the package contains package.json and scripts/post-install.js. That post-install script performs workspace detection, creates directories and config/state files, and prints guidance; it also inspects environment variables for LLM providers. Presence of a post-install script increases the attack surface (it will execute when installed via npm). There are no external arbitrary-download URLs observed in the provided files.
Credentials
Metadata declares no required env vars, yet post-install and code check for multiple LLM-related env vars (OPENAI_API_KEY, ANTHROPIC_API_KEY, DEEPSEEK_API_KEY, BAILIAN_API_KEY). The skill also documents notifyTarget values for external channels and may rely on platform-provided session tools. Probing for provider API keys without declaring them is a mismatch: it could be legitimate (skill tries to reuse whatever the host has), but it means the skill will behave differently depending on which secrets exist on the host. Users should not expose unrelated credentials to this skill.
Persistence & Privilege
always:false (no forced global inclusion) and default autonomous invocation are normal. The skill creates/updates files within workspaces (HEARTBEAT.md, ./memory/, MEMORY.md, heartbeat-state.json). That's expected for a memory-saving skill, but it does write to global user paths (~/.openclaw/workspace...) and maintains state across runs — consider this persistence when deciding install scope. It does not appear to change other skills' configs or set an always:true privilege.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install heartbeat-memory
  3. After installation, invoke the skill by name or use /heartbeat-memory
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v0.0.7
heartbeat-memory 0.0.7 - No code or documentation changes detected in this version. - No updates in features, configuration, or usage. - Behavior remains identical to previous release.
v0.0.6
heartbeat-memory 0.0.6 更新日志 - 支持自动检测“活跃 sessions”(即已有摘要但有新内容的会话),并进行增量摘要处理。 - 增量处理时会智能动态采样(单次 8-20 条消息,含 70% 用户消息),提高效率并减少重复劳动。 - 状态追踪优化:每个 session 记录最后处理位置,实现真正意义上的增量更新。 - 优化功能说明文档,详细标注增量摘要、活跃 session 处理及消息优先采样机制。 - 其它文档细节完善与说明增强。
v0.0.5
heartbeat-memory 0.0.5 更新摘要: - 文档结构全面重构,核心说明迁移至新版 SKILL.md,并新增 references/config.md、references/api.md、references/troubleshooting.md 等详细文档。 - 配置、故障排查、API 说明分拆到独立 markdown 文件,文档更加清晰易于查阅。 - 配置说明、路径描述与多工作区支持方案显著优化,路径示例和实践操作更加直接易懂。 - 新增 utils 目录及 config-sync.js、date-detector.js、session-filters.js 等实用工具代码,精简原有冗余实现。 - HEARTBEAT.md 自动同步、智能日期检测等特性纳入主文档,便于跟踪 Skill 状态与使用细节。 - 移除部分旧版工具脚本和重复内容,使结构更简明,专注于主线功能。
v0.0.4
## heartbeat-memory 0.0.4 Changelog - 新增「智能自愈」机制,自动检测并修复调用环境,不对时自动通过 subagent 重启执行,无需用户关心细节。 - 明确支持「Heartbeat 自动触发」和「手动触发」双模式,手动调用时自动适配环境。 - 文档大幅更新,详细说明手动触发用法、环境检测机制、错误提示及自愈流程。 - 增加文件系统扫描说明,支持备份已删除 sessions。 - 进一步强调无需单独配置 LLM,直接复用 OpenClaw 主配置。
v0.0.3
heartbeat-memory 0.0.3 - 文档全面升级,结构更清晰,支持快速上手指引 - 增加 clawhub/GitHub 安装说明,强调推荐全局安装 - 配置/操作文档极简优化,快速找到常用示例、修改入口等 - 常见问题与错误处理说明合并补全,便于新手排查和配置 - 明确多平台和多工作区支持方式,便于个性化部署 - 当前为文档优化版本,无功能代码变更
v0.0.2
fixed display name.
v0.0.1
Initial release of heartbeat-memory. - Automatically checks new sessions on each Heartbeat trigger and generates formatted daily notes. - Periodically refines MEMORY.md to summarize long-term memory. - Supports smart batch processing and progress tracking, including breakpoint resume. - Sends automatic notifications upon completion. - Zero manual operation needed—runs with every Heartbeat. - Flexible configuration supports custom batch sizes, notification targets, scheduling, and workspace selection. - Compatible with multi-workspace and cross-platform environments (macOS, Linux, Windows).
Metadata
Slug heartbeat-memory
Version 0.0.7
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 7
Frequently Asked Questions

What is skill-heartbeat-memory?

自动记忆保存 Skill。支持 Heartbeat 自动触发和主 Agent 中手动调用两种方式。自动检查新 sessions,生成 Daily 笔记,定期提炼 MEMORY.md,支持备份已删除的 sessions。 It is an AI Agent Skill for Claude Code / OpenClaw, with 241 downloads so far.

How do I install skill-heartbeat-memory?

Run "/install heartbeat-memory" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is skill-heartbeat-memory free?

Yes, skill-heartbeat-memory is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does skill-heartbeat-memory support?

skill-heartbeat-memory is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created skill-heartbeat-memory?

It is built and maintained by ZeroX (@justzerox); the current version is v0.0.7.

💬 Comments