← Back to Skills Marketplace
Forgetting Curve
by
whoisme007
· GitHub ↗
· v1.0.0
· MIT-0
162
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install forgetting-curve
Description
独立的 Ebbinghaus 遗忘曲线模块,提供记忆衰减计算和间隔重复调度
README (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 遗忘曲线模块
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install forgetting-curve - After installation, invoke the skill by name or use
/forgetting-curve - Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Frequently Asked Questions
What is Forgetting Curve?
独立的 Ebbinghaus 遗忘曲线模块,提供记忆衰减计算和间隔重复调度. It is an AI Agent Skill for Claude Code / OpenClaw, with 162 downloads so far.
How do I install Forgetting Curve?
Run "/install forgetting-curve" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Forgetting Curve free?
Yes, Forgetting Curve is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Forgetting Curve support?
Forgetting Curve is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Forgetting Curve?
It is built and maintained by whoisme007 (@whoisme007); the current version is v1.0.0.
More Skills