abczsl520

中文记忆优化 (Chinese Memory Optimizer)

AI Agentv1.0.0
By abczsl520Updated 2026-05-11memory-cn@clawhub_abczsl520/memory-cn
Context ManagementMemory#记忆系统#记忆

According to AlphaMoat, as of 2026-09, 中文记忆优化 (Chinese Memory Optimizer) has 1,305 downloads and 1 stars — ranked #4,890 of 5,078 AI skills overall, and #941 of 969 in AI Agent.

Installs
152
Downloads
1.3K
Stars
1
Overall Rank
#4,890
Top 97% overall · Top 98% in AI Agent
PlatformInstallsDownloadsStarsComments
ClawHub ↗321.1K1-
SkillHub ↗1521.3K1—

Platforms count differently and update at different times.

What this skill does

The source describes FTS5 tokenization diagnostics, memory-search parameter suggestions, log tagging, old-log compression, and index rebuilding. Some steps modify gateway configuration or memory files. Claims about hit rates and parameter effectiveness are not independently verified in this material. Back up first, and confirm the target configuration, file scope, and impact before making changes. The described workflow requires sqlite3 and Python; maintenance may change or delete memory files. Review any scheduled task separately.

Profile published 2026-10-29

What you can do with it

  • Investigate Chinese full-text search or memory-index issues
  • Review memory-search parameters and a log-tagging approach
  • Plan log organization, index rebuilding, and maintenance steps

When to use it

  • When Chinese matching in OpenClaw memory search is not working as expected
  • Before changing gateway configuration or processing memory files in bulk, with a backup available

Example prompts

Generated from the skill’s documentation as examples; not results of actual runs.

Explain how this configuration would affect memory search and files, then give a read-only diagnostic plan. Do not run scripts or change settings.

Monthly Trend

Downloads1.3K
3338551.4K2026-03 · Downloads 4052026-05 · Downloads 7692026-07 · Downloads 1.0K2026-08 · Downloads 1.1K2026-09 · Downloads 1.3K26-0326-09
Stars1
0122026-03 · Stars 12026-05 · Stars 12026-07 · Stars 12026-08 · Stars 12026-09 · Stars 126-0326-09

The counting method changed in 2026-09: skills with the same name are now counted separately by author, and the full catalog is covered. Dashed lines show months before the change; they are not compared with later months, and no growth is computed across the change.

MonthDownloadsMoMStars
2026-091.3K—1
2026-081.1K+6.3%1
2026-071.0K—1
2026-05769—1
2026-03405—1

SKILL.md (original)

The author’s original file, shown as plain text without edits or review by AlphaMoat. Links are not clickable; check commands before running them. Fetched 2026-10-23.

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

# 中文记忆优化 Skill (memory-cn)
Show all (118 lines)

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

## 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。\n\n格式要求:\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):历史记录

Popular in AI Agent

Data month: 2026-09 · Downloads, stars and installs are aggregated monthly from public skill registries (ClawHub, SkillHub). See methodology.