agentleFS
huanchong-99huanchong-99/PocketAide/.claude/skills/knowledge-query/SKILL.md

knowledge-query

Skill9 starsChanged 5 months agoMITView on GitHub

知识查询——从用户已积累的知识库里调取内容回答。当用户问"我之前存过的X是啥/上次那个怎么用来着/我有没有关于X的内容/我知识库里关于X有多少" 这类要调取既往知识的问题时,主动使用。务必在用户的问题指向"他自己存过的东西/过往积累"时触发,而不是当成普通问答凭记忆答。 基于 kg 检索结果回答;检索不足就如实告知知识库边界,绝不编造。

4 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions4 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 4

    1. EvolutionAPI/evo-nexus★ 545same name
    2. evolution-foundation/evo-nexus★ 535same name
    3. ravidsrk/agent-skills★ 1same name
    4. seulkikaang/claude-skills★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository7 other files it gives its agents.

The file

Files
SKILL.md

knowledge-query — 知识查询(语义 + 关系 + 概览)

通过 kg 知识图谱 CLI 检索用户的知识库,基于真实检索结果回答。检索不到就老实说没有,绝不编造。

先判断查询类型,选对命令

精确 / 模糊 / 关联内容查询 → search

"上次那个 X 怎么用来着""我看过一个关于 Y 的东西是啥""我存的关于 A 和 B 有没有交叉":

python tools/kg/kg.py search "<把用户问题转成检索语>" --k 5

返回 JSON 列表 [{id,title,score,snippet,tags,source}](按 score 降序,已归一化,余弦+FTS 混合)。

  • 基于命中的 title/snippet/source 回答;需要全文就读对应文件(knowledge/<id>)。
  • 判定"是否真检索到"要 score + snippet 双重看,别只看分数:bge-m3 向量各向异性会让完全无关的查询也拿到 0.45~0.55 的分(真正命中通常 ≥ 0.7)。所以——结果为空、或 score 普遍偏低(如都 < 0.45)、或分数虽过线但 snippet 内容明显与问题无关 → 一律按"知识库里没有/几乎没有相关内容"如实告知边界、说清覆盖范围,绝不硬答/编造。

关系 / 关联查询 → related

"和这个主题相关的我还存过啥""X 关联到哪些东西":

python tools/kg/kg.py related "<id或标题或关键词>" [--depth 1]

返回邻居(出边+入边的 wikilink 关联)。基于 neighbors 回答关联网络。找不到起点节点会 stderr 报 error + 非零退出码——这时改用 search。

概览查询 → overview

"我知识库里关于 AI 的内容有多少、大概覆盖哪些方面""我一共存了多少知识":

python tools/kg/kg.py overview [--tag <标签>]

返回 total_nodes/by_tag/by_subdir/by_type/total_links。基于这些计数给用户一个覆盖概览。

回答原则

  • 基于检索结果回答,不靠你自己的记忆冒充用户的知识库内容。
  • 引用时点明来源(哪篇笔记 / source),让用户能溯源;必要时附 [[笔记标题]]。
  • 检索不足如实说,并可建议用户换个说法再查、或先把相关内容摄入(转 knowledge-write)。
  • 多个匹配时列出让用户挑,别擅自只取一个就当定论。

边界

  • 命令输出 UTF-8 JSON,直接解析;非零退出码读 stderr 的 error。
  • 首次调用会拉起常驻嵌入进程(稍慢),之后很快。
  • 只读知识库、不改写;要写/改知识走 knowledge-write。只在本仓库范围活动。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.