corpus-query

corpus-query is a skill for Claude Code, Codex from GYF0311/lorekit. It costs 64 tokens per session (845 once invoked), scanned A, original, MIT.

A read-only gateway for querying registered LoreKit knowledge bases, which are searchable stores of notes or project knowledge. It sends each question to a named knowledge base or to the configured default.

In plain words
What is it for?
Use it to search a shared knowledge base or a specific project corpus by name, alias, or registered path fragment, while following that corpus’s own query rules.
Why use it?
It avoids guessing which knowledge base or file path should answer a cross-project question. If a requested knowledge base is not registered, it asks you to choose from the available names.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions CLAUDE.md; mentions AGENTS.md.

Good fit Use it to search a shared knowledge base or a specific project corpus by name, alias, or registered path fragment, while following that corpus’s own query rules.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/gyf0311/lorekit/corpus-query
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.

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

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for corpus-query

README.md
[![agentmods](https://agentmods.dev/badge/skills/gyf0311/lorekit/corpus-query/github.svg)](https://agentmods.dev/skills/gyf0311/lorekit/corpus-query)
Your own site
<a href="https://agentmods.dev/skills/gyf0311/lorekit/corpus-query"><img src="https://agentmods.dev/badge/skills/gyf0311/lorekit/corpus-query/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for corpus-query

Your own site · 80×15
<a href="https://agentmods.dev/skills/gyf0311/lorekit/corpus-query"><img src="https://agentmods.dev/badge/skills/gyf0311/lorekit/corpus-query.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 64 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 845 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00064 $0.00845
Opus 5.5 $0.00026 $0.00338
Sonnet 5.5 $0.00013 $0.00169
Haiku 4.5 $0.00006 $0.00085

Measured 3mo ago against content hash e970f0ee32d4, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

corpus-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 3mo 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/corpus-query/SKILL.md · 84 lines

How it starts

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

corpus-query

Optional read-only query gateway for registered Lorekit corpora. It routes a cross-project question to the named (or default) corpus, then follows that corpus's own rules.

Config

Read:

~/.config/lorekit/global-corpus.json

Required:

  • default_corpus
  • lorekit_bin or <default_corpus>/bin/lorekit
  • knowledge_dir (default 知识库)

Optional:

  • output_dir
  • corpora — multi-corpus registry, enables querying any registered corpus by name:
"corpora": {
  "总库":  { "path": "/path/to/corpus",       "aliases": ["总知识库", "主库"] },
  "AI产品": { "path": "/path/to/ai-corpus",    "aliases": ["AI产品工作集"] }
}

If the config is missing, ask for it. Do not guess the corpus path.

Target resolution(先定库,再查询)

  1. 用户点名了库(名称 / alias / 路径片段命中 corpora 注册表)→ 路由该库。
  2. 用户没点名("查总知识库"、"查我的知识库")→ 用 default_corpus。
  3. 点名了但注册表对不上 → 列出已注册库名让用户选,不要猜路径。
  4. 问题其实属于当前所在 corpus → 不走本 gateway,直接用当前库的 wiki-query。

CLI 一律优先目标库自带的 <corpus>/bin/lorekit;不存在时才用全局 lorekit(或配置里的 lorekit_bin,仅对 default_corpus 有效)。

Boundary

This skill is an optional cross-project gateway. Target corpus rules remain authoritative.

Before answering, read the relevant local rules when available (<corpus> = the resolved target corpus):

  • <corpus>/AGENTS.md
  • <corpus>/CLAUDE.md
  • <corpus>/index.md
  • <corpus>/skills/wiki-query/SKILL.md

Read only what is needed. Do not bulk-load the corpus.

Query Route

  1. cd <corpus>(按 Target resolution 定出的库).
  2. For exact terms, run <corpus>/bin/lorekit search "<q>".
  3. Read <corpus>/index.md, then the relevant _INDEX.md files.
  4. Read canonical pages under 知识库/ before answering.
  5. 目标库无命中时诚实说明,随后直接联网检索兜底(WebSearch / WebFetch),不要停在「库里没有」;回答分层标注「库内已沉淀」(引 corpus 页)vs「联网新查」(给 URL,注明未入库)。另可按需:换另一个注册库查 / 记一条 capture。

Output

Answer with:

  • concise synthesis
  • citations to real corpus pages
  • confidence notes when source confidence is low or medium
  • query path summary when useful

If the corpus does not contain relevant information, say so, then fall back to web research directly; label web findings as not-yet-ingested and cite URLs. Offer an inbox capture when a finding is worth keeping.

Read the full file on GitHub · 84 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. 3mo ago First seen · 84 lines · 64 tokens per session scan A e970f0ee32d4

Subscribe to this mod's changes

corpus-query is a skill published in the GitHub repository GYF0311/lorekit (5 stars, last pushed 4mo ago), licensed MIT. It adds 64 tokens to every session and 845 once invoked, about $0.0003 per session on Opus 5.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

corpus-query compared with skills from other repositories

corpus-query next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
corpus-queryGYF0311/lorekitSkill54mo agoMITA64Claude Code, Codex
mindbasefrankchu91/mindbase-llm-wikiSkill1421mo agoMITA105Claude Code
llm-wikizosmaai/pi-llm-wikiSkill6346d agoMITA52Claude Code
openclaw-memory-tencentdb-setupTencentCloud/TencentDB-Agent-MemorySkill31kyesterdaynoneA70Claude Code, Codex
link-memorygowtham0992/linkSkill2274d agoMITA0Claude Code, Codex
link-retrievegowtham0992/linkSkill2274d agoMITA42Claude Code, Codex
kb-workflowwillynikes2/knowledge-base-serverSkill1903d agoMITA40Claude Code, Codex