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-memory-alibaba-mysql_beta

v0.1.7

Published

OpenClaw memory plugin using Alibaba Cloud RDS MySQL vector storage

Readme

openclaw_memory_alibaba_mysql

OpenClaw 记忆插件,使用阿里云 RDS MySQL 向量存储。用户记忆细分为 fact / preference / decision 三类;支持全文记忆与自我改进记忆,抽取方式可选 regex 或 llm。

记忆分类 (category)

| 类型 | category | 说明 | |------|----------|------| | 用户事实 | user_memory_fact | 用户陈述的事实、习惯、身份信息等 | | 用户偏好 | user_memory_preference | 喜欢/不喜欢、偏好、意愿 | | 用户决策 | user_memory_decision | 已做的决定、打算、计划 |

  • 自动抓取 (autoCapture):按 memoryExtractionMethod 用 regex 或 LLM 从用户/对话中抽取并写入。
  • memory_store 工具:可显式指定 category,默认 user_memory_fact
  • 召回before_agent_startmemory_recall 统一按向量检索用户记忆(及可选 self_improving),注入上下文。

配置示例

最简配置(只接库 + 向量)

只配必填的 MySQL 和 Embedding,其它用默认:自动召回开、自动抓取关、不启用全文/自我改进/记忆衰减。

{
  "plugins": {
    "slots": { "memory": "openclaw_memory_alibaba_mysql" },
    "entries": {
      "openclaw_memory_alibaba_mysql": {
        "enabled": true,
        "config": {
          "mysql": {
            "host": "your-rds.aliyuncs.com",
            "port": 3306,
            "user": "openclaw",
            "password": "${MYSQL_PASSWORD}",
            "database": "openclaw",
            "ssl": true
          },
          "embedding": {
            "apiKey": "${DASHSCOPE_API_KEY}",
            "model": "text-embedding-v3",
            "baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1"
          }
        }
      }
    }
  }
}

最全配置(功能全开)

显式写出 MySQL、Embedding、LLM、自动抓取/召回、全文记忆、自我改进、记忆衰减、相似度阈值、表名等,便于按需裁剪。

{
  "plugins": {
    "slots": { "memory": "openclaw_memory_alibaba_mysql" },
    "entries": {
      "openclaw_memory_alibaba_mysql": {
        "enabled": true,
        "config": {
          "mysql": {
            "host": "your-rds.aliyuncs.com",
            "port": 3306,
            "user": "openclaw",
            "password": "${MYSQL_PASSWORD}",
            "database": "openclaw",
            "ssl": true
          },
          "embedding": {
            "apiKey": "${DASHSCOPE_API_KEY}",
            "model": "text-embedding-v3",
            "baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
            "dimensions": 1024
          },
          "llm": {
            "apiKey": "${DASHSCOPE_API_KEY}",
            "model": "qwen-plus",
            "baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1"
          },
          "memory_duplication_conflict_process": true,
          "similarityThresholdUserMemory": 0.95,
          "similarityThresholdSelfImproving": 0.92,
          "enableFullContextMemory": true,
          "enableSelfImprovingMemory": true,
          "memoryExtractionMethod": "llm",
          "autoRecall": true,
          "autoCapture": true,
          "captureMaxChars": 500,
          "enableMemoryDecay": true,
          "tableName": "openclaw_memories"
        }
      }
    }
  }
}

配置要点

  • 必填mysql(host / user / password / database 等)、embedding(apiKey、model)。
  • memoryExtractionMethod"regex""llm",对 user_memory_* 与 self_improving_* 同时生效;选 "llm" 需配 llm
  • enableFullContextMemory / enableSelfImprovingMemory:开启后可写全文记忆、自我改进记忆;全文记忆不参与常规召回。
  • memory_duplication_conflict_process:为 true 时用 LLM 做写入前去重/冲突判断,需配 llm
  • enableMemoryDecay:为 true 时对召回结果做时间衰减(半衰期与策略使用内置默认:30 天、指数衰减)。

环境变量

  • MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD:MySQL 连接(或在 config 里写死,password 支持 ${VAR})。
  • DASHSCOPE_API_KEY:DashScope 用于 embedding(若 apiKey 使用 ${DASHSCOPE_API_KEY})。

测试

export MYSQL_HOST=your-host MYSQL_PASSWORD=xxx DASHSCOPE_API_KEY=xxx
npx tsx test-agent-isolation.ts
npx tsx test-three-memory-types.ts
npx tsx test-full-context-memory.ts

文件说明

  • categories.ts:常量与类型(user_memory_、self_improving_、full_context_memory)。
  • config.ts:配置解析与默认值。
  • db.ts:MemoryDB 建表、store、search、softDelete(向量 COSINE)。
  • index.ts:插件注册、memory_recall / memory_store / memory_forget、before_agent_start / agent_end。
  • prompts.ts:用户记忆与 self_improving 的 LLM 抽取 Prompt。