wiki-query

A knowledge-base search skill that retrieves existing information from a local collection of documents and combines it into an answer. It can use exact matches, broader search, and links between related pages.

In plain words
What is it for?
It is for finding earlier notes, checking whether a topic was previously documented, following related pages, and separating stored knowledge from newly researched information.
Why use it?
It reduces the need to search documents manually and clearly says when the collection does not contain an answer.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/gyf0311/lorekit/wiki-query
Any agent
npx skills add GYF0311/lorekit --skill wiki-query
Clone the repo
git clone --depth 1 https://github.com/GYF0311/lorekit

Made for: Claude Code, Codex.

Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,560 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00056 $0.02560
Opus 5 $0.00028 $0.01280
Sonnet 5 $0.00011 $0.00512
Haiku 4.5 $0.00006 $0.00256

Measured 2d ago against content hash fc60bf606505, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

wiki-query scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/wiki-query/SKILL.md · 194 lines

How it starts

The opening of the file, as written. The whole thing — 194 lines — stays where its author put it; the contents beside it link to each section on GitHub.

wiki-query

从当前 corpus 回答问题。核心是三层检索决策 + 答案必须标注来源 + corpus 没有就诚实说没有。

When to trigger

  • 用户说"查一下 XXX"、"找一下 XXX"、"搜 XXX"
  • 用户说"我之前整理过 XXX 吗"、"记得 XXX 吗"、"之前说过 XXX"
  • 用户问"关于 XXX 我都有什么资料"
  • 用户抛一个概念性问题,且明显在问已有知识库,而不是要上网

不要触发

  • 查询后用户说"把这个记下来" → 交给 wiki-fileback
  • 用户给了新外部资料要存 → 交给 wiki-ingest
  • 用户在问外部新知识且明说不用查库 → 直接 WebSearch / WebFetch(默认仍先查库再联网兜底,见默认查询顺序第 6 步)

默认查询顺序

铁律:先走确定性文本层,不先启动重型召回流程。

默认顺序:

  1. rg / lorekit search "<q>" 找精确词、实体名、文件名和短语。
  2. Read corpus/index.md 定位知识分区。
  3. Read {dir}/_INDEX.md 缩小到候选页。
  4. Read 具体 知识库/ canonical page,再按页内 wikilink 追 1-2 跳。
  5. 第二级召回(fallback):1-4 步无命中或明显不足时,lorekit search "<q>" --all 把过程区(_工作台/_归档/输出/ 等)纳入召回。命中时照常引用,但必须 标注非 canonical(例如 ⚠ 过程稿:_工作台/草稿/xxx.md,未经入库校验), 不得当作 Compiled Truth 级证据。转写噪音层(_工作台/转写/)--all 仍排除, 先生点名"去转写里找"才 lorekit search "<q>" --dir _工作台/转写
  6. 联网兜底(web fallback):1-5 步都无命中(或问题本身涉及库外的新知识 / 时效 信息)时,直接WebSearch / WebFetch 联网检索,不要停在"库里没有"。 回答必须分层标注来源:「库内已沉淀」(引用 corpus 页面)vs「联网新查」(给 URL,注明未入库、未校验)。联网结论有长期复用价值时,提议 wiki-fileback / wiki-ingest 入库,由用户决定。

Decision tree

按 query 类型选层:

1. 精确关键词(实体名 / 文件名 / 具体词)

先走 lorekit search "<q>"(ripgrep fallback)。命中就读对应页面。

2. 模糊语义(概念性 / 意图类 / "跟 X 相关的东西")

  • Read corpus/index.md / 知识库/ → AI 按语义选 1-3 个分区
  • Read {选中分区}/_INDEX.md → 选具体页
  • Read 具体 .md 文件 → 综合答案
  • 只有需要完整 provenance 时才打开 原料/
  • _工作台/** / _归档/** 不是第一级召回层:知识库层无命中时走 lorekit search "<q>" --all 第二级召回(结果标注非 canonical);先生点名具体路径时直接读

3. 多跳推理("A 相关 B 的 C")

在第 2 步基础上,沿候选页的 [[wikilinks]] 递归遍历 1-2 步,综合。


大部分真实 query 是组合:先精确找锚点(第 1 步),再沿语义展开(第 2 步),最后拉链接(第 3 步)。

Tools to use

  • lorekit search "<q>" — 精确 ripgrep/fallback 检索(durable 层)
  • lorekit search "<q>" --all — 第二级召回,纳入工作台/归档等过程区
  • Read corpus/index.md / {dir}/_INDEX.md / 具体文件
  • 底层:Grep(复杂匹配时用)

Output format

综合答案时必须遵守:

  1. 每条信息标注来源 [[页面名]],用户能直接跳过去
  2. 如果 corpus 没相关内容,诚实说"corpus 里没有关于 XXX 的内容",永远不要瞎编
  3. 给出检索路径(可折叠),方便用户判断是不是漏了
  4. 末尾主动提议 fileback(见下一节)

Read the full file on GitHub · 194 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 194 lines · 56 tokens per session scan A fc60bf606505

Subscribe to this mod's changes

wiki-query is a skill published in the GitHub repository GYF0311/lorekit (5 stars, last pushed 1mo ago), licensed MIT. It adds 56 tokens to every session and 2,560 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

wegent-knowledge

Knowledge base management and search tools for Wegent. Provides capabilities to list, create, update, and search knowledge bases and documents using RAG retrieval. Use this skill when the user wants to manage knowledge bases, documents, or search for information programmatically.

wecode-ai/Wegent · 51 tokens

karpathy-llm-wiki

Use when building or maintaining a personal LLM-powered knowledge base. Triggers: ingesting sources into a wiki, querying wiki knowledge, linting wiki quality, 'add to wiki', 'what do I know about', or any mention of 'LLM wiki' or 'Karpathy wiki'.

Astro-Han/karpathy-llm-wiki · 67 tokens

tao-finetune-cosmos-embed

Cosmos-Embed1 video-text embedding for text-to-video retrieval, video-to-video search, semantic deduplication, and fine-tuning. Use when the user asks to "fine-tune Cosmos-Embed1", "run cosmos-embed inference", "export Cosmos-Embed1", "embed videos", or "search videos with text".

NVIDIA-TAO/tao-skill-bank · 79 tokens

grounded-answer

Answer a user question through DocMason's canonical grounded workflow using retrieval, provenance tracing, render escalation, and a final answer-state check.

JetXu-LLM/DocMason · 32 tokens

knowledge-base-sync

Stage, incrementally refresh, validate, and publish the DocMason knowledge base from the local source corpus.

JetXu-LLM/DocMason · 26 tokens

qi-cli

Guide for using qi, a local knowledge search CLI for macOS and Linux. Use this skill whenever the user asks about qi commands, indexing documents, searching a knowledge base, asking questions with RAG, configuring providers (Ollama, OpenAI), understanding search modes (BM25, hybrid, vector), or anything related to the…

itsmostafa/qi · 125 tokens