返回顶部
a

agent-memory-tools智能记忆工具

Searches, stores, and manages agent memory across 4 sources (fact store, vector embeddings, BM25, knowledge graph). Runs 100% local via Ollama — no API keys, no cloud dependency. Use when searching workspace knowledge, extracting facts from text, detecting contradictions, auto-ingesting file changes, or building entity graphs. Triggers on memory recall, fact extraction, knowledge search, workspace indexing.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
94
下载量
免费
免费
1
收藏
概述
安装方式
版本历史

agent-memory-tools

Agent Memory Tools

多源记忆召回与事实管理。通过Ollama本地运行(0€)。

架构

问题 → unified_recall.py → 扇出4个来源 → 合并 → 评分 → 重排序 → 回答
├─ 事实存储(Convex或本地JSON)
├─ 向量嵌入(nomic)
├─ BM25全文检索(QMD)
└─ 知识图谱(JSON)

文件变更 → auto_ingest.py → 提取事实 → 矛盾检查 → 存储
→ 更新嵌入 → 重建图谱

设置

bash

安装Ollama模型(一次性)


ollama pull gemma3:4b # LLM(约2秒/次调用)
ollama pull nomic-embed-text-v2-moe # 嵌入模型

验证一切正常

python3 scripts/selftest.py

要求:Python 3.9+、Ollama、curl。可选:QMD CLI(bun install -g qmd)。

核心脚本

搜索记忆

bash

统一召回 — 推荐(全部4个来源,评分+重排序)


python3 scripts/unified_recall.py 上周发生了什么bug? --debug

多跳推理(链式搜索+LLM综合)

python3 scripts/multihop_search.py 部署流水线是如何工作的? --embed

时间衰减(近期事实得分更高,错误受保护)

python3 scripts/decay_search.py 近期问题 --half-life 14

提取并存储事实

bash

从文本提取


python3 scripts/extract_facts.py 某段对话或文档 --store --debug

从文件提取

python3 scripts/extract_facts.py --file path/to/doc.md --store

从标准输入管道输入

cat summary.md | python3 scripts/extract_facts.py --store

事实在存储前会在本地进行矛盾检查(gemma3,约2秒)。分类:knowledge、error、timeline、preference、tool、client、hr。

自动摄取工作区变更

bash
python3 scripts/auto_ingest.py --scan # 一次性:处理已修改的.md文件
python3 scripts/auto_ingest.py --watch # 守护进程:每30秒轮询变更
python3 scripts/auto_ingest.py --file doc.md # 单个文件

通过内容哈希+5分钟冷却期去重。触发流程:事实提取→存储→嵌入缓存更新→图谱重建。

构建知识图谱

bash
python3 scripts/knowledge_graph.py # 完整重建
python3 scripts/knowledge_graph.py --dry-run # 预览而不写入

图谱存储在.cache/knowledge-graph.json。由auto_ingest.py增量自动重建。

运行测试

bash
python3 scripts/tests.py # 28个单元测试

配置

编辑scripts/config.json。完整指南见references/configuration.md。

存储后端 — 自动检测:

  • - 设置了convexUrl → 使用Convex(agentMemory API)
  • 无convexUrl → 使用本地.cache/agent-facts.json

模型预设 — 通过一个标志切换LLM/嵌入提供者:

bash
python3 scripts/unified_recall.py 查询 --preset ollama # 默认
python3 scripts/unified_recall.py 查询 --preset lmstudio
python3 scripts/unified_recall.py 查询 --preset openai

按脚本模型覆盖 — 在config.json中 → scriptOverrides:

json
scriptOverrides: {
recall: { llm: { model: gemma3:4b, apiFormat: ollama } },
extract: { llm: { model: gemma3:4b, apiFormat: ollama } }
}

按内存推荐模型:

内存LLM嵌入模型
4 GBgemma3:1bnomic-embed-text
8 GB
gemma3:4b ✓ | nomic-embed-text-v2-moe |
| 16+ GB | qwen3.5:27b | nomic-embed-text-v2-moe |

⚠ 避免在JSON任务中使用Qwen 3.5 — 输出会进入thinking字段而非响应。

平台自动触发

平台方法
macOS带WatchPaths的LaunchAgent
Linux
systemd定时器或cron | | Windows | 任务计划程序 |

示例见references/configuration.md。

文件结构

scripts/
├── unified_recall.py # 多源搜索+评分+综合
├── extract_facts.py # 事实提取+矛盾检查+存储
├── auto_ingest.py # 文件监视器/扫描器流水线
├── multihop_search.py # 链式推理搜索
├── decay_search.py # 时间加权搜索
├── knowledge_graph.py # 实体/关系图谱构建器
├── fact_store.py # 存储抽象层(Convex/本地JSON)
├── llm_client.py # LLM/嵌入客户端(Ollama/LM Studio/OpenAI)
├── selftest.py # 设置验证
├── tests.py # 单元测试(28个)
└── config.json # 配置+预设
references/
└── configuration.md # 完整配置指南

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 agent-memory-tools-1776062714 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 agent-memory-tools-1776062714 技能

通过命令行安装

skillhub install agent-memory-tools-1776062714

下载

⬇ 下载 agent-memory-tools v1.0.0(免费)

文件大小: 47.43 KB | 发布时间: 2026-4-14 14:37

v1.0.0 最新 2026-4-14 14:37
agent-memory-tools 1.0.0 — first release

- Search, store, and manage workspace knowledge across four local sources: fact store (Convex/JSON), vector embeddings, BM25 full-text, and knowledge graph.
- 100% local operation via Ollama; no API keys or cloud dependency required.
- Includes unified search, multi-hop reasoning, fact extraction with contradiction checks, auto-ingest from file changes, and knowledge graph building.
- Modular Python scripts for recall, extraction, ingestion, time-weighted search, and entity graph management.
- Flexible configuration for storage backend, LLM, and embeddings provider.
- Designed for privacy, extensibility, and easy local setup.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部