← 返回 Skills 市场
guohongbin-git

Memory Sync Enhanced

作者 Guohongbin · GitHub ↗ · v2.0.0
cross-platform ✓ 安全检测通过
774
总下载
1
收藏
4
当前安装
1
版本数
在 OpenClaw 中安装
/install memory-sync-enhanced
功能描述
增强版记忆系统 - Ebbinghaus 遗忘曲线 + Hebbian 共现图
使用说明 (SKILL.md)

增强版记忆系统

结合 Ebbinghaus 遗忘曲线 + Hebbian 共现图 的双层记忆架构。

架构

┌─────────────────────────────────────────────────────────┐
│                    记忆检索                              │
│  semantic_search() + co_occurrence_boost() + decay()    │
└─────────────────────────────────────────────────────────┘
                           │
           ┌───────────────┴───────────────┐
           ▼                               ▼
┌─────────────────────┐       ┌─────────────────────┐
│   Layer 1: 向量库   │       │  Layer 2: 共现图    │
│   (CortexGraph)     │       │  (Hebbian)          │
│                     │       │                     │
│ • 语义相似度        │◄─────►│ • 操作关联          │
│ • Ebbinghaus 衰减   │       │ • 边权重衰减        │
│ • use_count 追踪    │       │ • 跨域桥接          │
└─────────────────────┘       └─────────────────────┘

核心算法

Layer 1: Ebbinghaus 遗忘曲线

score = (use_count)^β × e^(-λ × Δt) × strength
  • β = 0.6(使用频率权重)
  • λ = ln(2) / half_life(默认 3 天)
  • strength = 1.0-2.0(重要性)

Layer 2: Hebbian 共现图

effective_weight = weight × 2^(-age_days / 30)
  • 每次记忆 A 和 B 同时被检索 → 边(A,B) 权重 +1
  • 边权重 30 天半衰期
  • 跨域桥接:音乐记忆 ↔ 编码记忆(因为同时发生)

检索流程

def retrieve_memory(query, top_k=10):
    # 1. 语义搜索
    semantic_results = cortexgraph.search(query, top_k * 2)
    
    # 2. 共现增强
    for mem in semantic_results:
        co_occur_boost = get_co_occurrence_score(mem.id, recent_context)
        mem.boosted_score = mem.semantic_score + co_occur_boost * 0.3
    
    # 3. 遗忘曲线过滤
    for mem in semantic_results:
        mem.final_score = mem.boosted_score * mem.decay_factor
    
    # 4. 返回 Top K
    return sorted(semantic_results, key=lambda x: x.final_score)[:top_k]

记忆类型

STM (短期记忆)

  • JSONL 格式
  • 快速读写
  • 高衰减率(3天 half-life)
  • 存储日常日志

LTM (长期记忆)

  • Obsidian Markdown
  • 永久存储
  • 低衰减率(30天 half-life)
  • 存储重要洞察

Co-occurrence Graph

  • SQLite 边表
  • 30天 half-life
  • 记录记忆之间的关联

数据结构

CortexGraph 记录

{
  "id": "uuid",
  "content": "记忆内容",
  "embedding": [0.1, 0.2, ...],
  "use_count": 5,
  "last_used": "2026-02-19",
  "strength": 1.5,
  "created_at": "2026-02-15",
  "tags": ["daily-log", "finding"]
}

Co-occurrence 边

CREATE TABLE co_occurrence (
  memory_a TEXT,
  memory_b TEXT,
  weight REAL,
  last_updated TEXT,
  PRIMARY KEY (memory_a, memory_b)
);

使用方法

同步记忆

# 同步 MEMORY.md
./scripts/sync-memory.sh

# 同步每日日志
./scripts/sync-daily.sh 2026-02-19

# 记录共现
./scripts/record-co-occurrence.sh

检索记忆

# 语义搜索
./scripts/search.sh "量化交易"

# 增强搜索(语义 + 共现)
./scripts/search-enhanced.sh "量化交易"

记忆管理

# 查看记忆统计
./scripts/stats.sh

# 垃圾回收(删除低分记忆)
./scripts/gc.sh --threshold 0.1

# 晋升到长期记忆
./scripts/promote.sh \x3Cmemory_id>

统计示例

=== 记忆系统统计 ===

总记忆数: 2,400
共现边: 803 (连接 366 个记忆)
平均每个记忆连接: 2.2 个

记忆分布:
- STM: 1,800 (75%)
- LTM: 600 (25%)

衰减状态:
- Danger zone (0.15-0.35): 120 个
- Healthy (0.35-0.65): 1,500 个
- Strong (>0.65): 780 个

与其他系统对比

系统 向量搜索 遗忘曲线 共现图
Markdown 文件
CortexGraph 原版
Zeph 的 Hebbian
本系统

设计理念

  1. 遗忘是功能 - 不是所有记忆都需要永久保存
  2. 关联即记忆 - 两个记忆同时出现 = 它们有关联
  3. 跨域桥接 - 穿衣服记录和调试记录可以关联
  4. 个性在桥接中 - 跨域边是 personality 所在

参考

  • CortexGraph
  • @Zeph 的 Hebbian 共现图帖子 (The Colony)
  • Ebbinghaus 遗忘曲线理论

版本: 2.0.0 结合 Ebbinghaus 遗忘曲线 + Hebbian 共现图

安全使用建议
This skill appears internally consistent and implements a local co-occurrence tracker. Before installing or running: (1) inspect any shell scripts referenced in SKILL.md (sync-*.sh, search.sh, gc.sh) because they are not included here — don't run unknown shell scripts; (2) note the tracker will create a database at ~/.config/cortexgraph/co_occurrence.db and directories under ~/.config — back up or review that location if you have naming conflicts; (3) if you plan to store sensitive memories, consider encrypting that DB or restricting filesystem permissions; (4) if you expect network integration (CortexGraph remote services), verify those components separately — this package makes no network calls itself.
功能分析
Type: OpenClaw Skill Name: memory-sync-enhanced Version: 2.0.0 The skill bundle implements an enhanced memory system using Ebbinghaus forgetting curve and Hebbian co-occurrence graphs. The `SKILL.md` and `README.md` files describe the system and provide usage examples for local scripts, without any prompt injection attempts or instructions for malicious actions. The `scripts/co_occurrence_tracker.py` script manages a local SQLite database (`~/.config/cortexgraph/co_occurrence.db`) using parameterized queries, preventing SQL injection, and does not exhibit any signs of data exfiltration, unauthorized network activity, or system compromise. All files align with the stated purpose and lack high-risk behaviors or malicious intent.
能力评估
Purpose & Capability
Name and description describe a memory system combining decay + co-occurrence. The included Python tracker implements Hebbian co-occurrence logic and a local SQLite DB at ~/.config/cortexgraph/co_occurrence.db — this is consistent with the stated purpose and no unrelated capabilities or credentials are requested.
Instruction Scope
SKILL.md instructs the agent to run various shell scripts (sync-memory.sh, search.sh, gc.sh, etc.). Those scripts are not included in the package; the provided Python file is limited to recording/querying co-occurrence and printing stats. The instructions do not ask the agent to read unrelated system files or exfiltrate data, but you should be aware the skill expects other scripts to exist (not provided here).
Install Mechanism
No install spec; the skill is instruction-only plus one harmless Python script. Nothing is downloaded from external URLs and no archives are extracted. Risk from install mechanism is low.
Credentials
No environment variables, credentials, or external endpoints are required. The script only writes to a user-scoped path (~/.config/cortexgraph), which is proportional to a local memory store.
Persistence & Privilege
always is false and the skill does not request system-wide changes. The only persistent artifact is a local SQLite DB in the user's config directory. The skill does not modify other skills' configs or request elevated privileges.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install memory-sync-enhanced
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /memory-sync-enhanced 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v2.0.0
Enhanced memory system with Ebbinghaus forgetting curve + Hebbian co-occurrence graph
元数据
Slug memory-sync-enhanced
版本 2.0.0
许可证
累计安装 4
当前安装数 4
历史版本数 1
常见问题

Memory Sync Enhanced 是什么?

增强版记忆系统 - Ebbinghaus 遗忘曲线 + Hebbian 共现图. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 774 次。

如何安装 Memory Sync Enhanced?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install memory-sync-enhanced」即可一键安装,无需额外配置。

Memory Sync Enhanced 是免费的吗?

是的,Memory Sync Enhanced 完全免费(开源免费),可自由下载、安装和使用。

Memory Sync Enhanced 支持哪些平台?

Memory Sync Enhanced 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Memory Sync Enhanced?

由 Guohongbin(@guohongbin-git)开发并维护,当前版本 v2.0.0。

💬 留言讨论