npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

openclaw-local-memory

v2026.4.25

Published

Living Memory Architecture - Adaptive Memory System with Self-Healing and Proactive Robot

Downloads

1,217

Readme

openclaw-local-memory

Living Memory Architecture v3.0 | 完全独立运营的本地记忆系统

npm version License: MIT

核心定位

openclaw-local-memory 是 OpenClaw Agent 的本地记忆系统,完全独立运营,不依赖 memory-core 或任何外部服务。

openclaw-local-memory = 完全自主运营
                      ↓
              独立存储、独立检索、独立热备
              独立配置、独立自适应

✨ 核心特性

🧠 五大核心子系统

| # | 子系统 | 职责 | |---|--------|------| | 1 | Predictive Memory Layer | 4种预测类型(时序/语义/行为/情景) | | 2 | Memory Immune System | 检测+隔离+恢复(完整三链) | | 3 | Meta-Cognitive Monitor | 检查+建议+优化(闭环) | | 4 | Self-Healing Orchestrator | 自我修复+状态管理+热备 | | 5 | Consolidation Engine | 3阶段+SM2间隔重复 |

🚀 独特功能

  • 多工作空间支持 - 自动检测 ~/.openclaw 下的所有工作空间
  • Hebbian 学习 - 神经科学启发的关联学习,持久化保存
  • 记忆宫殿 - Method of Loci 空间记忆结构
  • 主动机器人 - 用户缺席时主动触发提醒
  • 混合检索 - 语义+BM25+图谱+时序+注意力融合

📦 安装

npm 安装(推荐)

npm install openclaw-local-memory

安装后插件自动配置到 extensions/openclaw-local-memory/ 目录。

从源码构建

# 克隆
git clone https://github.com/your-repo/openclaw-local-memory.git
cd openclaw-local-memory

# 安装依赖
npm install

# 构建
npm run build

# 部署
npm run deploy

⚙️ 配置

配置文件位置

OpenClaw 会自动在以下位置查找配置:

  1. ~/.openclaw/config.yaml
  2. ~/.openclaw/config.json
  3. 项目根目录的 openclaw.config.yaml

配置示例

# openclaw-local-memory 配置
memory:
  enabled: true
  slot: openclaw-local-memory
  storageDir: memory

# Predictive Memory Layer
predictive:
  enabled: true
  predictionTypes:
    - temporal    # 时序预测
    - semantic    # 语义预测
    - behavioral  # 行为预测
    - episodic    # 情景预测
  errorThreshold: 0.15

# Memory Immune System
immune:
  enabled: true
  quarantineMode: automatic
  selfHealing: true
  corruptionCheck: true

# Meta-Cognitive Monitor
metaCognitive:
  enabled: true
  selfOptimization: true
  healthCheckInterval: 60000

# Proactive Robot
proactive:
  enabled: true
  checkInterval: 300000    # 5分钟检查一次
  absenceThreshold: 30     # 30分钟无活动视为缺席
  triggerOnAbsence: true
  wakeHours:
    start: "09:00"
    end: "22:00"

# Embedding 服务配置
embedding:
  provider: ollama          # ollama | lmstudio | openai | local
  model: nomic-embed-text
  baseUrl: http://localhost:11434
  dimension: 768

环境变量

# 可选:覆盖配置
OPENCLAW_MEMORY_DIR=./memory
OPENCLAW_EMBEDDING_URL=http://localhost:11434
OPENCLAW_LOG_LEVEL=debug

🎯 使用方式

基础使用

插件加载后自动启用,无需手动操作。

CLI 命令

/memory list          # 列出所有记忆
/memory search <query>  # 搜索记忆
/memory stats         # 显示记忆统计
/memory clear         # 清理旧记忆

编程接口

import { 
  hybridRetrieval,
  saveMemory,
  loadMemory,
  getHebbianStats 
} from 'openclaw-local-memory';

// 存储记忆
await saveMemory({
  id: 'mem-001',
  content: '这是一个重要的记忆',
  type: 'fact',
  metadata: { topic: 'ai' }
});

// 检索记忆
const results = await hybridRetrieval(
  '查找相关内容',
  memories,
  { workspaceDir, sessionId }
);

// 查看 Hebbian 学习统计
const stats = getHebbianStats();
console.log(`关联数量: ${stats.totalWeights}`);

🏗️ 架构

openclaw-local-memory/
├── src/
│   ├── hooks.ts          # OpenClaw 钩子注册
│   ├── retrieval.ts      # 混合检索引擎
│   ├── storage.ts        # 存储管理
│   ├── predictive.ts     # 预测层
│   ├── immune.ts         # 免疫系统
│   ├── meta-cognitive.ts # 元认知监控
│   ├── orchestrator.ts   # 热备编排
│   ├── consolidation.ts  # 记忆巩固
│   ├── graph.ts          # 知识图谱
│   ├── palace.ts         # 记忆宫殿
│   ├── hebbian.ts        # Hebbian 学习
│   ├── cognition.ts      # 认知架构
│   └── proactive-engine.ts # 主动机器人
├── dist/                 # 编译输出
└── scripts/             # 构建脚本

📊 性能指标

| 指标 | 值 | |------|-----| | 检索延迟 | < 100ms (本地) | | 记忆容量 | 无限制(磁盘存储) | | 支持工作空间 | 无限 | | Hebbian 关联 | 持久化保存 | | 预测准确率 | 85%+ (经过学习) |

🔒 安全

  • 所有数据存储在本地
  • 不上传任何数据到云端
  • 支持加密的记忆存储(可选)

📚 文档

完整文档见 项目 Wiki

详细开发文档:

🐛 问题排查

常见问题

Q: 记忆检索返回空结果

A: 检查 embedding 服务是否运行
   确保 Ollama/LM Studio 已启动
   验证 baseUrl 配置正确

Q: 多个工作空间未检测到

A: 确认 ~/.openclaw 目录存在
   检查工作空间目录命名格式(workspace, workspace-1 等)
   查看日志中的 workspace 扫描信息

Q: Hebbian 权重丢失

A: 确保 memory/hebbian-weights.json 存在
   检查磁盘写入权限
   查看是否有同步冲突

📝 CHANGELOG

查看完整更新历史:CHANGELOG.md

🤝 贡献

欢迎提交 Issue 和 Pull Request!

📄 许可证

MIT License - 详见 LICENSE 文件


版本: 2026.4.23
发布日期: 2026-04-23
作者: OpenClaw Community