← 返回 Skills 市场
Forgetting Curve
作者
whoisme007
· GitHub ↗
· v1.0.0
· MIT-0
162
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install forgetting-curve
功能描述
独立的 Ebbinghaus 遗忘曲线模块,提供记忆衰减计算和间隔重复调度
使用说明 (SKILL.md)
Forgetting Curve 模块
独立的 Ebbinghaus 遗忘曲线实现,为记忆系统提供标准化衰减计算。
功能特性
- 多种衰减模型:Ebbinghaus 指数衰减、幂律衰减、自定义半衰期
- 间隔重复调度:基于记忆强度的下一次复习时间计算
- 可配置参数:半衰期、初始强度、衰减因子
- 跨平台兼容:独立模块,无外部依赖
核心算法
Ebbinghaus 指数衰减
decay = 2^(-age_days / half_life_days)
其中:
age_days: 距离最后一次复习的天数half_life_days: 半衰期(默认 30 天)
间隔重复调度(SRS)
next_review_days = base_interval * (strength ^ factor)
其中:
base_interval: 基础间隔(如 1 天)strength: 当前记忆强度(0.0-1.0)factor: 强度因子(默认 1.5)
使用方法
基本衰减计算
from forgetting_curve import ForgettingCurve
# 创建衰减器(默认半衰期 30 天)
curve = ForgettingCurve(half_life_days=30.0)
# 计算衰减因子
age_days = 7 # 7 天前记忆
decay = curve.calculate_decay(age_days) # 返回 0.82
# 应用衰减到记忆强度
original_strength = 0.9
decayed_strength = curve.apply_decay(original_strength, age_days) # 0.74
间隔重复调度
from forgetting_curve import SpacedRepetitionScheduler
scheduler = SpacedRepetitionScheduler()
# 计算下一次复习时间
current_strength = 0.6
next_review_days = scheduler.next_review_interval(current_strength) # 3.1 天
# 更新记忆强度(复习后)
new_strength = scheduler.update_strength(current_strength, success=True) # 0.75
批量处理
# 批量计算衰减
import pandas as pd
from forgetting_curve import batch_decay
memories = [
{"id": "mem1", "strength": 0.9, "age_days": 3},
{"id": "mem2", "strength": 0.7, "age_days": 15},
{"id": "mem3", "strength": 0.5, "age_days": 60}
]
decayed = batch_decay(memories, half_life_days=30)
# 返回带衰减后强度的列表
配置参数
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
half_life_days |
float | 30.0 | 半衰期(天) |
initial_strength |
float | 1.0 | 初始记忆强度 |
minimum_strength |
float | 0.1 | 最低强度阈值 |
base_interval |
float | 1.0 | 基础复习间隔(天) |
strength_factor |
float | 1.5 | 强度因子 |
easy_factor |
float | 1.3 | 简单记忆因子 |
hard_factor |
float | 0.8 | 困难记忆因子 |
与现有系统集成
1. Memory Sync Enhanced
# co_occurrence_tracker.py 中替换硬编码衰减
# 旧代码:
# decay = math.pow(2, -age_days / 30.0)
# 新代码:
from forgetting_curve import ForgettingCurve
curve = ForgettingCurve(half_life_days=30.0)
decay = curve.calculate_decay(age_days)
2. CortexGraph 集成
# 在检索时应用遗忘曲线过滤
from forgetting_curve import ForgettingCurve
def retrieve_memories(query, top_k=10):
# ... 语义搜索 ...
for mem in results:
age_days = (datetime.now() - mem.last_used).days
decay = curve.calculate_decay(age_days)
mem.score *= decay
# ... 返回结果 ...
扩展性
自定义衰减函数
from forgetting_curve import ForgettingCurve
# 自定义衰减函数
def custom_decay(age_days, strength):
return strength * math.exp(-age_days / 45.0)
curve = ForgettingCurve(decay_function=custom_decay)
多级记忆系统
# 不同记忆类型使用不同半衰期
short_term = ForgettingCurve(half_life_days=3.0) # 短期记忆
long_term = ForgettingCurve(half_life_days=90.0) # 长期记忆
procedural = ForgettingCurve(half_life_days=7.0) # 程序性记忆
性能基准
1000 次衰减计算: 0.8ms
10000 次批量衰减: 5.2ms
内存占用: \x3C 1MB
安装
作为独立模块
# 从当前目录安装
pip install -e .
# 或直接复制文件
cp forgetting_curve.py /your/project/
作为 OpenClaw 技能
# 通过 ClawHub 发布后
clawhub install forgetting-curve
开发指南
项目结构
forgetting-curve/
├── forgetting_curve.py # 核心模块
├── test_decay.py # 单元测试
├── examples/ # 使用示例
├── config/ # 配置文件
└── SKILL.md # 本文档
运行测试
python test_decay.py
路线图
v0.1.0 (MVP)
- 基本 Ebbinghaus 衰减计算
- 可配置半衰期
- 强度衰减应用
v0.2.0
- 间隔重复调度
- 多种衰减模型(幂律、指数混合)
- 批量处理优化
v0.3.0
- 记忆分类(STM/LTM)
- 自适应半衰期(基于使用频率)
- 可视化工具
v1.0.0
- 完整 SRS 算法
- 与 Anki/Mnemosyne 兼容
- 跨语言绑定
参考
- Hermann Ebbinghaus (1885) - 遗忘曲线
- Piotr Wozniak (1987) - SuperMemo 算法
- Spaced Repetition Systems - 现代间隔重复理论
版本: 0.1.0 独立的 Ebbinghaus 遗忘曲线模块
安全使用建议
This skill is coherent and appears safe to inspect and run locally: review the single Python file and run its tests as shown. Two things to keep in mind before deploying widely: (1) provenance: the source/homepage is unknown—confirm the license and origin if you need long-term support or legal clarity; (2) the API accepts a custom decay_function (a callable) — do not pass untrusted/remote code as that would execute arbitrary logic. Otherwise it is a small, self-contained math module without network or credential access.
功能分析
Type: OpenClaw Skill
Name: forgetting-curve
Version: 1.0.0
The skill bundle is a legitimate implementation of the Ebbinghaus forgetting curve for memory decay and spaced repetition scheduling. The Python code in forgetting_curve.py uses only standard libraries (math, dataclasses, datetime) to perform mathematical calculations and contains no network activity, file system access, or suspicious execution patterns.
能力评估
Purpose & Capability
The name/description (forgetting curve / spaced repetition) matches the code and SKILL.md: all required functionality (decay calculations, SRS scheduling, batch helpers) is implemented and no unrelated capabilities are requested.
Instruction Scope
SKILL.md instructs only how to import/use the module, integrate it into memory systems, and install it locally. There are no instructions to read unrelated files, access environment variables, or send data to external endpoints.
Install Mechanism
No install spec is declared (instruction-only skill with an included .py file). The README shows local pip install or copying the file; no network downloads or opaque installers are used by the skill itself.
Credentials
The skill declares no required environment variables, credentials, or config paths. The code does not access OS credentials, network, or external services.
Persistence & Privilege
always is false and the module does not modify other skills or system settings. It runs as a plain library with no autonomous background behavior.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install forgetting-curve - 安装完成后,直接呼叫该 Skill 的名称或使用
/forgetting-curve触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of the forgetting-curve skill — a standalone Ebbinghaus forgetting curve and spaced repetition module.
- Implements exponential and power-law decay models for memory.
- Provides interval scheduling based on memory strength (SRS support).
- All parameters (half-life, strength, decay factor) are configurable.
- Easy integration with other systems; fully independent with no external dependencies.
- Includes batch operations and custom decay/extensibility support.
元数据
常见问题
Forgetting Curve 是什么?
独立的 Ebbinghaus 遗忘曲线模块,提供记忆衰减计算和间隔重复调度. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 162 次。
如何安装 Forgetting Curve?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install forgetting-curve」即可一键安装,无需额外配置。
Forgetting Curve 是免费的吗?
是的,Forgetting Curve 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Forgetting Curve 支持哪些平台?
Forgetting Curve 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Forgetting Curve?
由 whoisme007(@whoisme007)开发并维护,当前版本 v1.0.0。
推荐 Skills