← 返回 Skills 市场
89
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install linkmind-pro
功能描述
LinkMind 知识连接引擎 Phase 2 - 本地化知识中枢 CLI 工具,支持 storage adapter 抽象层和 OpenAI-compatible embedding provider。
使用说明 (SKILL.md)
LinkMind 知识连接引擎 (Phase 2)
LinkMind 是一个本地化知识连接引擎,将异构内容沉淀为统一知识单元,建立可解释的节点连接网络,并支持带证据的查询回答。
Phase 2 新增功能
- Storage Adapter 抽象层:
JsonStorageAdapter(默认,保持兼容)+SqliteStorageAdapter(基于 better-sqlite3) - Embedding Provider 抽象层:
MockProvider(离线测试)+OpenAICompatibleProvider(接入 OpenAI/vLLM/Ollama) - 向量相似度召回:余弦相似度 ranker,与关键词召回结果合并去重
- 渐进升级:Phase 1 JSON 方案完全兼容,无需迁移
核心功能
- 摄入 (ingest): 读取本地文本文件,切分为语义友好的段落片段,抽取概念节点,建立片段-概念、片段-片段邻接连接
- 查询 (query): 支持关键词/概念查询 + 向量相似度召回,返回答案摘要、证据片段列表、相关概念节点、统计概览
- 状态 (status): 查看当前工作空间统计信息
- 重置 (reset): 清空工作空间
架构模块
| 模块 | 职责 | 状态 |
|---|---|---|
storage-adapters/ |
StorageAdapter 接口 + JSON/SQLite 双实现 | ✅ Phase 2 |
embedding-providers/ |
EmbeddingProvider 接口 + Mock/OpenAI 双实现 | ✅ Phase 2 |
retriever |
关键词召回 + 向量召回双层检索,余弦相似度 ranker | ✅ Phase 2 |
unit-builder |
文档切分为 fragment,抽取 fragment.conceptNames | ✅ MVP |
link-builder |
fragment↔concept、fragment↔fragment 邻接连接 | ✅ MVP |
answer-composer |
组装 answer + evidence + relatedConcepts | ✅ MVP |
ingest-normalizer |
原始文件标准化为 Document | ✅ MVP |
guardrails |
空查询、空结果边界处理 | ✅ MVP |
技术栈
- 零外部依赖(pure Node.js built-ins)
- 本地 JSON 文件存储(
data/workspace.json) - 可选 SQLite 存储(
better-sqlite3) - 数据模型: Document → Fragment → Concept + LinkEdge
安装与运行
cd skills/linkmind
# 构建
npm run build
# 运行 CLI
node dist/index.js --help
使用方法
摄入文档
node dist/index.js ingest --file examples/sample-note.md --title "我的笔记" --sourceType note
查询知识
node dist/index.js query --q "知识连接"
node dist/index.js query --q "knowledge" --limit 5
查看状态
node dist/index.js status
重置工作空间
node dist/index.js reset
存储适配器 (Storage Adapter)
JsonStorageAdapter(默认)
- 数据存储在
data/workspace.json - 完全向后兼容 Phase 1
- 零配置开箱即用
SqliteStorageAdapter
- 需要安装:
npm install better-sqlite3 - 数据存储在
data/db.sqlite - 支持事务批量写入,性能更高
import { createStorageAdapter } from './src/storage-adapters/index.js';
const adapter = createStorageAdapter('sqlite');
await adapter.init();
await adapter.saveDocument({ id: 'doc_1', title: 'Test', ... });
Embedding Provider
MockProvider(默认,离线可用)
import { createEmbeddingProvider } from './src/embedding-providers/index.js';
const provider = createEmbeddingProvider('mock', { dimension: 1536 });
const [vec] = await provider.embed(['hello world']);
OpenAICompatibleProvider
const provider = createEmbeddingProvider('openai', {
baseURL: 'https://api.openai.com/v1', // 或 vLLM/Ollama 地址
apiKey: 'sk-xxx',
model: 'text-embedding-3-small',
dimension: 1536
});
const vectors = await provider.embed(['hello', 'world']);
检索流程 (Retriever)
查询时使用双层召回:
- 关键词召回(keyword):基于
normalizeConcept+ concept 名称匹配 - 向量召回(vector):余弦相似度(可选,需配置 embedding provider)
- 合并去重:取最高分,结果标记
source: 'keyword' | 'vector' | 'hybrid'
import { retrieve } from './src/retriever.js';
const results = await retrieve({
fragments,
query: 'knowledge graph',
embeddingProvider: mockProvider, // 传 null 则仅关键词召回
limit: 10
});
// results: [{ fragmentId, documentId, documentTitle, score, text, source }]
数据模型
Document
{
"id": "doc_xxxxx",
"type": "document",
"title": "我的笔记",
"sourceType": "note",
"sourceUri": "/path/to/file.md",
"importedAt": "2026-04-04T...",
"status": "active"
}
Fragment
{
"id": "frag_xxxxx",
"type": "fragment",
"documentId": "doc_xxxxx",
"index": 0,
"text": "LinkMind 是...",
"summary": "LinkMind 是...",
"conceptNames": ["linkmind", "知识连接", "知识中枢"]
}
Concept
{
"id": "concept_xxxxx",
"type": "concept",
"name": "LinkMind",
"normalizedName": "linkmind",
"salience": 0.67
}
LinkEdge
{
"id": "link_xxxxx",
"type": "mentions",
"fromId": "frag_xxxxx",
"fromType": "fragment",
"toId": "concept_xxxxx",
"toType": "concept",
"score": 2
}
自测方法
cd skills/linkmind
node tests/smoke-test.js
目录结构
skills/linkmind/
├── SKILL.md
├── README.md
├── package.json
├── src/
│ ├── index.js # CLI 入口
│ ├── retriever.js # 双层检索
│ ├── storage-adapters/
│ │ ├── StorageAdapter.js # 接口契约
│ │ ├── JsonStorageAdapter.js # JSON 文件实现
│ │ ├── SqliteStorageAdapter.js # SQLite 实现
│ │ └── index.js # Factory
│ ├── embedding-providers/
│ │ ├── EmbeddingProvider.js # 接口契约
│ │ ├── MockProvider.js # 随机向量(测试用)
│ │ ├── OpenAICompatibleProvider.js # OpenAI 兼容 API
│ │ └── index.js # Factory
│ └── utils/
│ └── nlp.js # normalizeConcept 工具
├── dist/
│ └── index.js
├── data/
│ └── workspace.json
├── tests/
│ └── smoke-test.js # Phase 2 覆盖 38 项检查
└── examples/
└── sample-note.md
Phase 2 交付清单
- StorageAdapter 接口契约
- JsonStorageAdapter(向后兼容)
- SqliteStorageAdapter(基于 better-sqlite3)
- EmbeddingProvider 接口契约
- MockProvider(确定性随机、缓存、L2归一化)
- OpenAICompatibleProvider(支持自定义 baseURL/apiKey/model)
- retriever.js:关键词+向量双层召回 + 余弦相似度 ranker + merge 去重
- smoke-test.js Phase 2 全覆盖(38项检查全部通过)
- SKILL.md 更新
待后续实现
- ⏳ index.js 接入 adapter 层(DI 注入,支持 --storage=json|sqlite)
- ⏳ 向量批量预计算 + 离线向量存储
- ⏳ 图数据库存储(Neo4j)
- ⏳ Web/开放 API 接口
- ⏳ 多种来源接入(飞书、Notion、URL 抓取)
- ⏳ 证据冲突检测
安全使用建议
Summary of important points and what to check before installing/running:
- Purpose-match: The code implements a local CLI knowledge engine (ingest, query, JSON/SQLite storage, mock/OpenAI-compatible embedding). That matches the SKILL.md description.
- Network access: If you enable the OpenAICompatibleProvider (type 'openai'), the skill will make outbound HTTP POSTs to the configured baseURL and will include the supplied API key (Authorization: Bearer ...) if provided. Only enable that when you trust the baseURL and provide a key you control.
- Dependency mismatch: The SQLite adapter's code requires better-sqlite3, but package.json lists optionalDependency "sqlite3". If you plan to use SQLite, ensure better-sqlite3 is installed (or adjust the code/package) — otherwise the adapter will throw on init. This is likely a packaging bug, not necessarily malicious, but it can cause runtime surprises.
- CLI/provider mismatch: The CLI/help refers to a 'keyword' embedding mode/default while the embedding factory supports 'mock' and 'openai'. Expect to supply 'mock' or 'openai' explicitly when invoking the CLI or using the API; otherwise embedding-based reranking may not behave as documented.
- Filesystem effects: The tool reads user-specified files for ingestion and writes the workspace to data/workspace.json (and data/db.sqlite if using SQLite). The included smoke-test runs CLI commands (via child_process.execSync) and will modify the skill's data directory. Back up any important files before running tests or reset commands.
- Provenance: The skill metadata shows a repository URL in skill.json, but the top-level metadata lists Source: unknown and Homepage: none. If provenance matters to you, inspect the repo (https://github.com/harrylabsj/linkmind) and verify the publisher before trusting the package.
- Recommended actions:
- Review the OpenAICompatibleProvider usage and confirm the baseURL you will point it at, and avoid supplying production secrets to unknown endpoints.
- If you plan to enable SQLite storage, install better-sqlite3 (or fix package.json) and test in a sandbox.
- Run the CLI and smoke-test in an isolated environment (e.g., a disposable project directory) so you can inspect created data/workspace.json.
- If you are not comfortable with the dependency/packaging inconsistencies or unknown provenance, treat this as untrusted code and do not provide sensitive API keys or run it on production data.
Confidence: medium — the code and docs are largely coherent but packaging/CLI mismatches and the unknown source require caution.
功能分析
Type: OpenClaw Skill
Name: linkmind-pro
Version: 1.0.0
The LinkMind Pro skill bundle is a legitimate local knowledge management CLI tool that implements RAG (Retrieval-Augmented Generation) capabilities. It includes modules for document ingestion, concept extraction, and hybrid (keyword + vector) search. While the tool performs file system operations (reading/writing to the 'data' directory) and network requests (to OpenAI-compatible embedding endpoints), these actions are strictly aligned with its stated purpose. The code is well-structured, lacks obfuscation, and contains no evidence of malicious intent, data exfiltration, or unauthorized persistence mechanisms.
能力评估
Purpose & Capability
Name/description align with the included code: the package implements a local CLI for ingest/query with JSON/SQLite storage and mock/OpenAI-compatible embedding providers. However there are small mismatches: the README and code mention better-sqlite3 as the SQLite dependency while package.json lists optionalDependency "sqlite3" (different package); the CLI help and some code reference a 'keyword' embedding mode/default but the embedding factory only supports 'mock' and 'openai'. These inconsistencies look like sloppy packaging rather than malicious intent, but they are unexplained.
Instruction Scope
SKILL.md instructs building (npm run build) and running the bundled CLI (node dist/index.js) and shows example CLI commands (ingest, query, status, reset). The runtime instructions operate on files within the skill (data/workspace.json, examples/) and on user-supplied files for ingest. The code does not instruct reading unrelated system config or exfiltrating data. The included smoke-test runs the CLI via execSync (shell) which will modify files under the skill's data directory when executed; that's expected for tests but users should be aware it performs filesystem operations.
Install Mechanism
There is no external install script; this is an instruction- and code-bundle (no downloads). All code is included in the skill archive; nothing is fetched from arbitrary URLs at install time. No extract-from-URL or remote installer is present.
Credentials
The skill declares no required environment variables or primary credentials. The OpenAICompatibleProvider accepts an apiKey/baseURL model in its constructor and will call the configured baseURL (e.g., api.openai.com or a self-hosted vLLM/Ollama endpoint) via fetch; the skill itself does not request an API key via env, nor declare one in metadata. This is acceptable but means the user must supply keys at runtime. Also, package.json optionalDependencies mismatch (sqlite3 vs better-sqlite3) may lead to unexpected install-time behavior if the user attempts to enable SQLite.
Persistence & Privilege
The skill does not request always:true or other elevated platform privileges. It stores workspace data under the skill's data/ directory (data/workspace.json and optional data/db.sqlite) and does not attempt to modify other skills or system-wide config. The smoke-test and CLI will write/read those local files.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install linkmind-pro - 安装完成后,直接呼叫该 Skill 的名称或使用
/linkmind-pro触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
LinkMind Phase 2 introduces major new capabilities for local knowledge retrieval:
- Added Storage Adapter abstraction: supports both JSON (default, backward compatible) and high-performance SQLite.
- Added Embedding Provider abstraction: includes offline MockProvider and OpenAI-compatible provider (works with OpenAI/vLLM/Ollama).
- Enabled dual-layer retrieval: combines keyword recall and cosine similarity-based vector search with deduplication.
- Fully backward compatible with Phase 1 JSON data—no migration needed.
- Enhanced CLI: new commands for ingesting content, querying, status checks, and workspace resetting.
- Provided extensive examples, architecture details, and self-test scripts in documentation.
元数据
常见问题
Linkmind 是什么?
LinkMind 知识连接引擎 Phase 2 - 本地化知识中枢 CLI 工具,支持 storage adapter 抽象层和 OpenAI-compatible embedding provider。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 89 次。
如何安装 Linkmind?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install linkmind-pro」即可一键安装,无需额外配置。
Linkmind 是免费的吗?
是的,Linkmind 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Linkmind 支持哪些平台?
Linkmind 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Linkmind?
由 haidong(@harrylabsj)开发并维护,当前版本 v1.0.0。
推荐 Skills