← 返回 Skills 市场
Co Occurrence Engine
作者
whoisme007
· GitHub ↗
· v1.0.0
· MIT-0
153
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install co-occurrence-engine
功能描述
独立的 Hebbian 共现图引擎,记录记忆共现,计算关联权重,支持关联查询和数据库维护,服务星型记忆架构。
使用说明 (SKILL.md)
co-occurrence-engine
独立的 Hebbian 共现图引擎,为星型记忆架构提供记忆关联发现与权重计算服务。
功能
- 共现记录:自动记录同时被检索的记忆对,建立关联边
- 关联查询:查询与指定记忆最相关的其他记忆
- 权重计算:基于使用频率与时间衰减计算关联强度
- 统计信息:提供边数、唯一记忆数、平均权重等统计
- 维护工具:清理过旧的边,保持数据库健康
架构
┌─────────────────────────────────────────────────────┐
│ 共现图引擎 (独立插件) │
│ │
│ • CoOccurrenceEngine 类 │
│ • SQLite 数据库 (共现图) │
│ • 遗忘曲线集成 (可选) │
└─────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ 适配器 (co_occurrence_adapter) │
│ │
│ • 实现统一记忆接口 │
│ • 注册到星型架构适配器框架 │
└─────────────────────────────────────────────────────┘
核心类
CoOccurrenceEngine
主引擎类,提供共现图的所有操作。
engine = CoOccurrenceEngine(db_path="~/.config/cortexgraph/co_occurrence.db")
主要方法:
record_co_occurrence(memory_ids: List[str], context: str = "")get_co_occurrence_score(memory_id: str, related_ids: List[str] = None) -> floatget_related_memories(memory_id: str, top_k: int = 10) -> List[Tuple[str, float]]get_stats() -> Dictdecay_old_edges(days: int = 90) -> int
## 数据库
默认数据库位置:`~/.config/cortexgraph/co_occurrence.db`
表结构:
```sql
CREATE TABLE co_occurrence (
memory_a TEXT,
memory_b TEXT,
weight REAL,
last_updated TEXT,
created_at TEXT,
PRIMARY KEY (memory_a, memory_b)
)
集成
1. 独立使用
from scripts.co_occurrence_tracker import CoOccurrenceEngine
engine = CoOccurrenceEngine()
engine.record_co_occurrence(["mem_001", "mem_002"])
related = engine.get_related_memories("mem_001")
2. 通过适配器集成
from adapter_factory import AdapterFactory
factory = AdapterFactory()
adapter = factory.get_adapter("co_occurrence")
results = adapter.search("mem_001", max_results=10)
配置
通过环境变量或配置文件:
CO_OCCURRENCE_DB_PATH:数据库路径(默认:~/.config/cortexgraph/co_occurrence.db)CO_OCCURRENCE_HALF_LIFE_DAYS:衰减半衰期(默认:30天)
依赖
- Python 3.8+
- SQLite3(内置)
- 可选:
forgetting-curve插件(提供更精确的衰减计算)
版本历史
- v0.1.0(初始版本):从 memory-sync-enhanced 中提取的共现图引擎
安全使用建议
This skill appears coherent and local-only: it creates and updates a SQLite DB at ~/.config/cortexgraph/co_occurrence.db and does not contact external endpoints or request secrets. Before installing, consider: (1) any memory IDs you pass to the tracker will be stored on disk — avoid feeding sensitive secrets if you don't want them persisted; (2) the code optionally imports a third-party 'forgetting_curve' module if installed — only install/allow that package from a trusted source; (3) confirm the DB path is acceptable or override CO_OCCURRENCE_DB_PATH if you prefer a different location; (4) if you integrate this with other components (adapter_factory or external adapters), review those adapter implementations to ensure they don't leak data. Overall the skill is internally consistent and low-risk, but treat stored memory contents as persistent data you control.
功能分析
Type: OpenClaw Skill
Name: co-occurrence-engine
Version: 1.0.0
The skill bundle implements a standard Hebbian co-occurrence engine using a local SQLite database (~/.config/cortexgraph/co_occurrence.db) to track relationships between memory IDs. The code in scripts/co_occurrence_tracker.py uses parameterized SQL queries to prevent injection and lacks any indicators of data exfiltration, malicious execution, or prompt injection.
能力评估
Purpose & Capability
Name/description (Hebbian co-occurrence engine) matches the included implementation: a Python tracker that records co-occurrence edges in a local SQLite DB under ~/.config/cortexgraph. No unrelated services, credentials, or binaries are requested.
Instruction Scope
SKILL.md and the Python file confine operations to local DB read/write, queries, decay, and maintenance. Instructions reference only the DB path and optional half-life setting; they do not instruct reading unrelated system files or sending data externally.
Install Mechanism
No install spec or remote downloads are present. The skill is instruction-only with a bundled Python script, so nothing is fetched from external URLs during install.
Credentials
No required environment variables or credentials are declared. SKILL.md documents optional env vars (CO_OCCURRENCE_DB_PATH, CO_OCCURRENCE_HALF_LIFE_DAYS) that are reasonable for configuration. The code writes only to a per-user config path.
Persistence & Privilege
always is false and the skill does not request elevated privileges or modify other skills. It creates/uses a local DB file under the user's config directory (normal for this kind of tool).
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install co-occurrence-engine - 安装完成后,直接呼叫该 Skill 的名称或使用
/co-occurrence-engine触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of co-occurrence-engine.
- Introduces an independent Hebbian co-occurrence graph engine for associative memory discovery within a star-shaped memory architecture.
- Features co-occurrence recording, association queries, frequency & time-based weight calculations, stats reporting, and maintenance tools.
- Provides a dedicated SQLite data backend, optional forgetting curve integration, and adapter for unified memory interfaces.
- Configurable via environment variables; designed for easy direct use or integration through adapters.
- Requires Python 3.8+ and SQLite3.
元数据
常见问题
Co Occurrence Engine 是什么?
独立的 Hebbian 共现图引擎,记录记忆共现,计算关联权重,支持关联查询和数据库维护,服务星型记忆架构。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 153 次。
如何安装 Co Occurrence Engine?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install co-occurrence-engine」即可一键安装,无需额外配置。
Co Occurrence Engine 是免费的吗?
是的,Co Occurrence Engine 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Co Occurrence Engine 支持哪些平台?
Co Occurrence Engine 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Co Occurrence Engine?
由 whoisme007(@whoisme007)开发并维护,当前版本 v1.0.0。
推荐 Skills