Knowledge Skill 是 tao3k/xiuxian-artisan-workshop 项目中的知识管理技能,内部代号 Project Cortex,定位为结构化知识注入与长期知识检索。其边界明确:本技能只处理可持久、可复用的知识;短期操作记忆属于 Rust memory core,并通过 memory skill facade 单独暴露。
用途 该技能用于搜索文档、检索项目标准、记录持久笔记,以及管理长期知识库内容。它提供统一的搜索入口,避免在多个搜索工具之间产生歧义,同时支持知识写入、会话总结、文档摄取与 LinkGraph 图结构检索。
主要能力
- 统一搜索(knowledge.search):所有知识搜索的单一入口,支持 hybrid(link_graph+vector)、keyword(ripgrep)、link_graph(仅链接)、vector(仅语义)四种模式,可指定 max_results 与 scope(仅 keyword 模式有效,可选 docs、references、skills、harvested、all)。
- 文档与标准检索:search_documentation 搜索 markdown 文档与参考资料;search_standards 搜索 docs/reference/ 下的编码标准与工程指南。
- 语义搜索:knowledge_search(别名 code_search)对代码模式与文档进行语义搜索;code_context 返回适合 LLM 使用的上下文块。
- 知识库管理:update_knowledge_base 保存知识条目(category 可选 patterns/solutions/errors/techniques/notes,支持 tags);search_notes 搜索已有笔记与知识条目;summarize_session 将当前会话轨迹总结为结构化 markdown,可选择是否包含失败方法。
- 知识运维:ingest_knowledge 摄取或更新项目知识库(clean=true 时全量重建索引);knowledge_status 查看知识库状态。
- LinkGraph 能力:link_graph_toc 获取全部笔记概览目录;link_graph_hybrid_search 结合 LinkGraph 推理与向量搜索回退;link_graph_stats 获取知识库统计;link_graph_refresh_index 触发索引刷新(支持 changed_paths 增量与 force_full 全量);link_graph_links 查找与指定笔记存在链接关系的笔记;link_graph_find_related 通过链接图遍历发现相关笔记。link_graph 模式还支持 schema-v2 的 search_options,可进行精确匹配、排序与过滤(如 link_to 递归距离、tags 过滤),响应中包含 parsed_query 与规范化后的 effective search_options。
- 文档摄取:ingest_document 对 PDF、Markdown 等文档执行完整 RAG 流程——解析、分块(sentence、paragraph、sliding_window、semantic)、可选实体抽取与图存储,最后写入向量库。file_path 支持本地路径或 PDF URL,URL 会先下载到项目数据目录(.data/knowledge/downloads)再处理。
使用方式 所有命令通过 @omni 调用,例如: @omni("knowledge.search", {"query": "UltraRAG research report"}) @omni("knowledge.search", {"query": "architecture", "mode": "keyword", "scope": "harvested"}) @omni("knowledge.search_documentation", {"query": "trinity architecture"}) @omni("knowledge.search_standards", {"topic": "python linting"}) @omni("knowledge.knowledge_search", {"query": "error handling patterns", "limit": 5}) @omni("knowledge.code_context", {"query": "how to handle errors", "limit": 3}) @omni("knowledge.update_knowledge_base", {"category": "patterns", "title": "Error Handling Pattern", "content": "Use Result types instead of exceptions...", "tags": ["error", "python"]}) @omni("knowledge.search_notes", {"query": "error handling", "category": "patterns"}) @omni("knowledge.summarize_session", {"session_id": "session-123", "trajectory": [{"step": 1, "action": "search", "result": "found 5 files"}], "include_failures": true}) @omni("knowledge.ingest_knowledge", {"clean": false}) @omni("knowledge.knowledge_status") @omni("knowledge.link_graph_toc", {"limit": 50}) @omni("knowledge.link_graph_hybrid_search", {"query": "architecture MCP", "use_hybrid": true}) @omni("knowledge.link_graph_stats") @omni("knowledge.link_graph_refresh_index", {"changed_paths": ["docs/architecture/kernel.md"]}) @omni("knowledge.link_graph_links", {"note_id": "architecture", "direction": "both"}) @omni("knowledge.link_graph_find_related", {"note_id": "agent-skills", "max_distance": 2}) @omni("knowledge.ingest_document", {"file_path": "docs/guide.pdf"}) @omni("knowledge.ingest_document", {"file_path": "https://arxiv.org/pdf/2601.03192"})
适用场景
- 在项目中检索架构、标准、编码规范等文档内容。
- 将可复用的模式、解决方案、错误处理经验、技巧与笔记写入长期知识库。
- 对会话执行轨迹进行结构化总结,保留失败经验。
- 通过 LinkGraph 发现笔记之间的链接关系与相关笔记。
- 将 PDF 或 Markdown 文档摄取进知识库,构建可检索的向量与图结构。
限制与注意事项
- 本技能仅面向持久、可复用的知识;短期操作记忆不属于本技能范围。
- 统一搜索是推荐入口,应优先使用 knowledge.search,而非单独调用 search/link_graph_hybrid_search,以避免工具歧义。
- scope 参数仅在 mode=keyword 时有效。
- 最佳实践建议:新增知识前先搜索是否重复;按 category 组织条目;使用一致的 tags;包含代码示例以提升 AI 理解。
- 关于收费、价格、平台支持范围等信息,资料中暂未提供。