2026-02-20 Thursday
【免费下载链接】LEANN[MLsys2026 Best Paper]: https://arxiv.org/abs/2506.08276. RAG on Everything with LEANN. Enjoy 97% storage savings while running a fast, accurate, and 100% private RAG application on your personal device.项目地址: https://gitcode.com/GitHub_Trending/le/LEANN
- Deployed the v2.1.0 hotfix for the payment gateway timeout issue.
- Root cause: connection pool exhaustion under high concurrent load.
- Fix: increased pool size from 10 to 50 and added circuit breaker pattern.
- Alice reviewed the Kubernetes HPA settings — autoscaling now triggers at 60% CPU.
- Need to follow up with the SRE team about Prometheus alerting thresholds.
从格式上看,这是一份典型的**半结构化工作日志记忆**:`#` 标题记录日期与星期,正文用无序列表逐条记录当日关键事件。同类文件还包括 `2026-02-15.md`(REST 迁移 gRPC 的讨论与基准测试结论)和 `2026-02-25.md`(与 ML 团队讨论向量数据库选型,最终决定用 LEANN 做 PoC)。它们共同构成 OpenClaw 记忆检索测试的输入语料。 在 `conftest.py` 中,`memory_fixtures` fixture 会把整个 fixtures 目录复制到临时目录供测试使用,`skill_dir` 则指向 `skills/leann-memory`,说明这些记忆文件正是 `leann-memory` 技能要索引、检索的典型数据源。 ## 二、为什么这类记忆文件适合做语义检索 像 `2026-02-20.md` 这样的工作日志,关键字面(如 "pool size"、"HPA"、"circuit breaker")与实际业务提问之间存在语义鸿沟。使用者更可能这样提问: - "支付网关超时问题我们是怎么修复的?" - "连接池参数改成多少了?" - "自动扩缩的触发条件是什么?" 这些问题几乎不会与日志文本逐字重合,但语义高度相关。这正是 LEANN 语义检索的用武之地。[leann-memory 技能说明](https://link.gitcode.com/i/dbf792473ec39e0eb4d9e4f4a387b563) 明确指出,LEANN 提供 **97% 存储压缩的语义记忆搜索**:传统方案为每个 chunk 保存完整嵌入向量(50K 片段约 75 MB),LEANN 通过基于图的"选择性重算"压缩到约 2 MB,并且使用本地嵌入模型,零 API 成本、零网络延迟。其工作原理是:LEANN 只存储剪枝后的邻居图而非完整向量,检索时由本地守护进程按需重算嵌入,OpenClaw 的异步"睡眠时间计算"模型恰好能隐藏这一重算延迟。 因此,把 `2026-02-20.md` 这类记忆文件纳入 LEANN 索引,等于给智能体装上了"以语义而非关键词回忆工作史"的能力。 ## 三、安装与首次建索引 `leann-memory` 技能以 OpenClaw skill 形式分发,`skills/leann-memory/claw.json` 清单显示其许可为 `["shell"]`、入口为 `instructions.md`、兼容 Claude/GPT/Gemini/Qwen/Llama 等模型,要求 OpenClaw 0.8.0+。安装分两步: ```bash # 安装 LEANN 核心 pip install leann-core # 安装技能(或手动复制目录到 ~/.openclaw/workspace/skills/leann-memory/) clawhub install leann-team/leann-memory首次使用前用which leann校验 CLI 是否就绪。然后对记忆文件建索引(命令取自 skills/leann-memory/instructions.md):
leann build openclaw-memory \ --docs ~/.openclaw/workspace/MEMORY.md ~/.openclaw/workspace/memory/ \ --embedding-model all-MiniLM-L6-v2 \ --embedding-mode sentence-transformers把~/.openclaw/workspace/memory/替换为本文示例所在的tests/openclaw/fixtures/memory/目录即可对2026-02-20.md等文件建索引。几个关键参数的底层语义可以在 cli.py 中确认:
--embedding-model:嵌入模型名,CLI 默认值为facebook/contriever(见 cli.py L810);技能文档推荐轻量的all-MiniLM-L6-v2,两者均可在本地运行。--embedding-mode:嵌入执行模式,传入sentence-transformers时走本地 sentence-transformers 路径(相关提示逻辑见 embedding_compute.py)。- 索引是幂等的:重复执行
leann build只处理新增或变更的文件,不会重复嵌入。
四、语义检索:把日志变成可问答的记忆
建好索引后,用leann search检索(命令同样出自 instructions.md):
leann search openclaw-memory "payment gateway timeout root cause" --top-k 5 --json --non-interactive这里--top-k控制返回条数(CLI 默认 5,见 cli.py L515),--json输出机器可读结果,--non-interactive适合被 Agent 直接调用。--json的输出格式如下:
[ { "id": "a1b2c3", "score": 0.847, "text": "Deployed the v2.1.0 hotfix for the payment gateway timeout issue...", "metadata": { "file_path": "/data/web/disk1/git_repo/GitHub_Trending/le/LEANN/tests/openclaw/fixtures/memory/2026-02-20.md", "source": "memory/2026-02-20.md" } } ]每个结果包含id、score、text、metadata四要素,metadata记录了来源文件路径,便于做溯源引用。针对这份日志,以下几类问句都能命中对应条目:
- "我们是怎么修支付网关超时的?" → 命中 v2.1.0 热修复记录
- "连接池现在多大?" → 命中 "increased pool size from 10 to 50"
- "HPA 什么时候触发扩容?" → 命中 "autoscaling now triggers at 60% CPU"
- "SRE 那边还有什么待办?" → 命中 "follow up with the SRE team about Prometheus alerting thresholds"
若结果不够全面,将--top-k提升到 10~15 即可获得更完整的上下文(instructions.md 的 Tips 部分明确说明这是低成本操作)。
五、持续同步:让记忆索引跟随日志增长
记忆文件会持续追加,因此需要保持索引更新。技能提供了两种方式:
# 一次性检查并重建(处理新增/变更文件) leann watch openclaw-memory --once # 后台持续监控,每 30 秒检查一次 leann watch openclaw-memory --interval 30【免费下载链接】LEANN[MLsys2026 Best Paper]: https://arxiv.org/abs/2506.08276. RAG on Everything with LEANN. Enjoy 97% storage savings while running a fast, accurate, and 100% private RAG application on your personal device.项目地址: https://gitcode.com/GitHub_Trending/le/LEANN
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考