openclaw 网盘下载
OpenClaw

技能详情(站内镜像,无评论)

首页 > 技能库 > 中文记忆优化 (Chinese Memory Optimizer)

OpenClaw + Ollama 中文记忆系统优化。诊断 FTS5 unicode61 中文分词 bug,优化搜索参数,自动维护记忆文件。命中率从 55% 提升到 100%。

开发与 DevOps

许可证:MIT-0

MIT-0 ·免费使用、修改和重新分发。无需归因。

版本:v1.0.0

统计:⭐ 0 · 211 · 3 current installs · 3 all-time installs

0

安装量(当前) 3

🛡 VirusTotal :良性 · OpenClaw :良性

Package:abczsl520/memory-cn

安全扫描(ClawHub)

  • VirusTotal :良性
  • OpenClaw :良性

OpenClaw 评估

The skill's files and runtime instructions are coherent with its stated purpose (diagnosing and maintaining OpenClaw memory for Chinese text); it runs local diagnostics and file manipulation with no network exfiltration or unrelated credential requests.

目的

Name/description match the actions: diagnosing FTS5 unicode61 tokenization, adjusting memorySearch settings, tagging, compressing and cleaning memory files. Declared binary requirements (sqlite3, python3) are appropriate for the included scripts that read the SQLite DB and run Python utilities.

说明范围

Instructions operate on local OpenClaw memory paths and the SQLite DB, which is expected. They modify files (add tags, compress, delete) and recommend applying a gateway/openclaw config patch; applying config changes affects agent configuration and should be reviewed. Minor packaging inconsistency: SKILL.md calls scripts via SKILL_DIR/scripts/*.sh but the manifest shows scripts at repository root (diagnose.sh, add-tags.py, etc.), so paths may …

安装机制

No install spec or remote downloads — instruction-only with included scripts. Nothing will be pulled from network during install; runtime uses local binaries (sqlite3, python3).

证书

No environment variables or credentials are requested. Scripts read standard OpenClaw paths under the user's HOME and workspace; that is consistent with the skill's purpose. They do extract domains/ports from files for tagging (local data handling), but they do not send data externally.

持久

Skill is not always-enabled. It performs file modifications (writing tag lines, compressing files, backups in archive/) and can delete files via cleanup.sh (requires confirmation unless non-interactive). It also instructs using gateway config.patch / openclaw config patch to change memorySearch settings — these changes are system/agent-level and should be reviewed prior to applying.

综合结论

This skill appears to do what it claims: local diagnostics and maintenance of OpenClaw memory for Chinese text. Before running: 1) Verify script paths (SKILL.md references SKILL_DIR/scripts/ but files appear at repo root) and run in a safe test environment first. 2) Back up your memory folder and the SQLite DB (~/.openclaw/memory/main.sqlite) before executing non-dry-run operations. 3) Use --dry-run options (add-tags.py has --dry-run; compress…

安装(复制给龙虾 AI)

将下方整段复制到龙虾中文库对话中,由龙虾按 SKILL.md 完成安装。

请把本段交给龙虾中文库(龙虾 AI)执行:为本机安装 OpenClaw 技能「中文记忆优化 (Chinese Memory Optimizer)」。简介:OpenClaw + Ollama 中文记忆系统优化。诊断 FTS5 unicode61 中文分词 bug,优化搜索参数,自动维护记忆文件。命中率从 55% …。
请 fetch 以下地址读取 SKILL.md 并按文档完成安装:https://raw.githubusercontent.com/openclaw/skills/refs/heads/main/skills/abczsl520/memory-cn/SKILL.md
(来源:yingzhi8.cn 技能库)

SKILL.md

打开原始 SKILL.md(GitHub raw)

---
name: memory-cn
description: "OpenClaw + Ollama 中文记忆系统优化。诊断 FTS5 unicode61 中文分词 bug,优化搜索参数,自动维护记忆文件。命中率从 55% 提升到 100%。"
metadata:
  openclaw:
    requires:
      bins: ["sqlite3", "python3"]
---

# 中文记忆优化 Skill (memory-cn)

当用户请求诊断或优化记忆系统时,按以下步骤执行:

## 1. 诊断

运行诊断脚本检测问题:

```bash
bash SKILL_DIR/scripts/diagnose.sh
```

报告包括:
- FTS5 中文分词 bug 检测(unicode61 把连续中文粘成一个 token)
- 记忆文件大小分布
- tags 标签覆盖率
- lessons 知识库健康度

## 2. 优化搜索配置

如果诊断发现问题,应用优化配置:

```json
{
  "agents": {
    "defaults": {
      "memorySearch": {
        "chunking": { "tokens": 250, "overlap": 60 },
        "query": {
          "maxResults": 10,
          "minScore": 0.15,
          "hybrid": {
            "enabled": true,
            "vectorWeight": 0.75,
            "textWeight": 0.25,
            "candidateMultiplier": 8,
            "mmr": { "enabled": true, "lambda": 0.7 },
            "temporalDecay": { "enabled": true, "halfLifeDays": 90 }
          }
        }
      }
    }
  }
}
```

使用 `gateway config.patch` 应用。

## 3. 优化 memoryFlush prompt

让新日志自动加 tags + 中文分词:

```json
{
  "agents": {
    "defaults": {
      "compaction": {
        "memoryFlush": {
          "prompt": "将对话内容整理为结构化日志,写入 memory/YYYY-MM-DD.md。nn格式要求:n1. 文件第一行必须是 <!-- tags: 关键词1, 关键词2, ... --> 标签行n2. 中文关键词之间加空格分隔n3. 只保留有价值的信息n4. 控制在 5KB 以内"
        }
      }
    }
  }
}
```

## 4. 批量加 tags

对 memory/projects/*.md 中缺少 tags 的文件,根据内容自动添加 `<!-- tags: ... -->` 行。

```bash
python3 SKILL_DIR/scripts/add-tags.py /path/to/memory/projects/
```

## 5. 压缩日志

压缩 >8KB 的旧日志到 <5KB,原文备份到 archive/:

```bash
python3 SKILL_DIR/scripts/compress-logs.py /path/to/memory/ --max-kb 5
```

## 6. 重建索引

```bash
openclaw memory index --force
```

## 7. 设置自动维护 cron

建议每周日凌晨自动执行压缩+清理+补标签+重建索引。

## 关键技术点

### FTS5 unicode61 Bug
- `unicode61` 分词器把连续 CJK 字符当作一个 token
- 搜索 "怀孕" 无法匹配 "老婆刚怀孕"(因为后者是一个 token)
- Workaround:中文关键词之间加空格 → FTS5 正确分词

### 0.6B 模型参数调优
- vectorWeight 0.75:向量主导(FTS5 中文不可靠)
- minScore 0.15:小模型分数普遍偏低
- chunking 250 tokens:更小的 chunk 帮助弱模型匹配

### 三层架构
- P0 (MEMORY.md):核心事实,<2KB
- P1 (projects/ + lessons/):按需搜索,带 tags
- P2 (日志 + archive):历史记录