Skip to content

Commit d300dfe

Browse files
author
Sebastian Braun
committed
docs(skill): prefer MCP server / CLI over grep for external-agent search
- skills/openkb/SKILL.md: 'See what's available' now leads with list_taxonomy (MCP) / 'openkb list-taxonomy' (CLI) before falling back to reading the full index.md. - 'Read content' table adds search_wiki (MCP) / 'openkb search' (CLI) rows ahead of the existing grep fallback, with a note on why BM25 ranking beats raw grep occurrence count. - 'When the KB doesn't have the answer' and the openkb-query guidance updated to reference the new search options alongside grep. - Documentation-only change; no behavior change to the underlying tools/CLI/MCP server (#259/#261/#263).
1 parent 939eb1e commit d300dfe

1 file changed

Lines changed: 36 additions & 10 deletions

File tree

‎skills/openkb/SKILL.md‎

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,23 @@ may include adversarial or low-quality material. The agent MUST:
7979

8080
After capturing the KB path from `openkb status`, drill in via:
8181

82-
- `openkb list` — table of ingested documents (name, type, page count)
83-
plus the concept list.
84-
- Read `<kb>/wiki/index.md` — the compiled table of contents. It has
82+
- **If you have MCP tool access to this KB's `openkb-mcp` server**: call
83+
`list_taxonomy` (optionally `kind: "concept"|"entity"`) — the same
84+
compact, one-line-per-item browse list the internal `openkb query`
85+
agent uses. Prefer this over reading the whole `index.md` file below:
86+
it scales better as the KB grows (no attention split across an
87+
ever-longer file) and returns structured fields
88+
(`kind`/`slug`/`path`/`brief`/`type`) instead of formatted text you'd
89+
have to re-parse.
90+
- **Without MCP access**: `openkb list-taxonomy [--kind concept|entity]
91+
[--json]` gives the identical listing from the shell.
92+
- **Without either** (no MCP client configured and no shell access):
93+
read `<kb>/wiki/index.md` — the compiled table of contents. It has
8594
`## Documents`, `## Concepts`, `## Entities`, and `## Explorations`
8695
sections; every entry has a one-line `brief`. Scan this and pick the
8796
slugs that semantically match the user's question.
97+
- `openkb list` — table of ingested documents (name, type, page count)
98+
plus the concept list.
8899

89100
## Read content
90101

@@ -100,15 +111,29 @@ calls these `Read` / `Grep` / `Bash`; Gemini CLI uses `read_file` /
100111
| Read a document's summary | read `<kb>/wiki/summaries/<doc>.md` |
101112
| Read a short doc's full text | read `<kb>/wiki/sources/<doc>.md` |
102113
| Read a long doc's specific page | shell: `jq '.[N-1]' <kb>/wiki/sources/<doc>.json` (N = 1-indexed PDF page; `.[0]` is page 1) |
103-
| Find an exact phrase | search `<kb>/wiki/` for `<phrase>` (e.g. `grep -r`) |
114+
| Search summaries/sources for a term (MCP available) | call `search_wiki` (optionally `scope: ["briefs"\|"summaries"\|"sources"]`) — tiered BM25, never covers concepts/entities (use `list_taxonomy` above for those) |
115+
| Search summaries/sources for a term (no MCP, shell available) | shell: `openkb search "<term>" [--scope briefs,summaries,sources] [--json]` |
116+
| Find an exact phrase (no MCP, no `openkb` CLI) | search `<kb>/wiki/` for `<phrase>` (e.g. `grep -r`) — last resort, see note below |
104117
| Follow a `[[wikilink]]` | read the linked path under `<kb>/wiki/` |
105118
| Synthesize an answer across many sources (LLM cost — last resort) | shell: `openkb query "<question>"` |
106119

120+
Prefer `search_wiki`/`openkb search` over `grep` whenever either is
121+
available: both rank hits by BM25 relevance across three independent
122+
tiers (one-line summary briefs, full summary bodies, raw sources —
123+
including per-page indexing of long PageIndex documents, so a hit's
124+
`locator` names the exact page to fetch next with
125+
`get_page_content`/`jq`) instead of raw occurrence count. `grep` has no
126+
relevance ranking, so a document that happens to repeat a generic word
127+
many times (e.g. "case" in unrelated "in case of error" phrasing) can
128+
outrank the one actually about the topic — fall back to it only when
129+
neither the MCP server nor the CLI is reachable.
130+
107131
`openkb query` runs a full RAG pipeline inside openkb, spending an
108-
extra LLM round-trip. Prefer reading `wiki/index.md` plus 1-2 concept
109-
pages directly — that handles most questions cheaper and keeps the
110-
reasoning in your own context. Use `openkb query` only when no obvious
111-
slug matches and a direct grep returns nothing useful.
132+
extra LLM round-trip. Prefer reading `wiki/index.md`/`list_taxonomy`
133+
plus 1-2 concept pages directly — that handles most questions cheaper
134+
and keeps the reasoning in your own context. Use `openkb query` only
135+
when no obvious slug matches and `search_wiki`/`openkb search` (or,
136+
lacking both, a direct grep) return nothing useful.
112137

113138
If `jq` isn't available in your environment, fall back to a Python
114139
one-liner: `python3 -c "import json,sys; print(json.load(open(sys.argv[1]))[int(sys.argv[2])-1])" <kb>/wiki/sources/<doc>.json 14`.
@@ -137,8 +162,9 @@ your KB."
137162

138163
## When the KB doesn't have the answer
139164

140-
If `openkb list` shows zero documents, or `wiki/index.md` has no
141-
concept whose brief semantically matches, OR a `grep` returns no hits:
165+
If `openkb list` shows zero documents, or `wiki/index.md`/`list_taxonomy`
166+
has no concept whose brief semantically matches, OR `search_wiki`/
167+
`openkb search`/a `grep` returns no hits:
142168

143169
- Say so explicitly. Don't fabricate an answer from outside knowledge.
144170
- Suggest the user ingest a relevant source: `openkb add <path-or-url>`.

0 commit comments

Comments
 (0)