Problem
openkb query / openkb chat navigate the wiki purely via index.md one-line summaries plus
LLM-directed page reads (read_file, get_page_content). One-line summaries cannot surface facts
buried deep in a concept/entity/summary page body (a specific figure, a niche keyword, an exact
term). As the wiki grows past a few dozen pages, the agent increasingly misses pages whose
index.md summary doesn't happen to mention the exact term the user asked about, even though the
page body contains the answer.
This is a known limitation of the underlying "LLM Wiki" pattern OpenKB implements (see
Karpathy's original gist and
its comments): index-based navigation works well at moderate scale, but recall degrades for
buried details. The suggested mitigation is a hybrid retrieval strategy — union the
index-driven candidates with a full-text search result set, so recall can only improve, never
regress relative to index-only navigation.
Context
openkb query/openkb chat (openkb/agent/query.py) currently expose only read_file,
get_page_content, and get_image as retrieval tools — no keyword/full-text search tool.
openkb's dependencies are pinned exactly and vetted deliberately (see pyproject.toml); adding
a new indexing dependency (e.g. Whoosh, tantivy bindings) is a heavier ask than a small,
dependency-free BM25 implementation over the wiki's Markdown files.
Vorschlag
Add a lightweight, dependency-free BM25 full-text index over concepts/, entities/, and
summaries/ wiki pages, exposed to the query/chat agent as a search_wiki(query) tool alongside
the existing index.md-driven navigation (hybrid retrieval — additive, not a replacement).
Problem
openkb query/openkb chatnavigate the wiki purely viaindex.mdone-line summaries plusLLM-directed page reads (
read_file,get_page_content). One-line summaries cannot surface factsburied deep in a concept/entity/summary page body (a specific figure, a niche keyword, an exact
term). As the wiki grows past a few dozen pages, the agent increasingly misses pages whose
index.mdsummary doesn't happen to mention the exact term the user asked about, even though thepage body contains the answer.
This is a known limitation of the underlying "LLM Wiki" pattern OpenKB implements (see
Karpathy's original gist and
its comments): index-based navigation works well at moderate scale, but recall degrades for
buried details. The suggested mitigation is a hybrid retrieval strategy — union the
index-driven candidates with a full-text search result set, so recall can only improve, never
regress relative to index-only navigation.
Context
openkb query/openkb chat(openkb/agent/query.py) currently expose onlyread_file,get_page_content, andget_imageas retrieval tools — no keyword/full-text search tool.openkb's dependencies are pinned exactly and vetted deliberately (seepyproject.toml); addinga new indexing dependency (e.g. Whoosh, tantivy bindings) is a heavier ask than a small,
dependency-free BM25 implementation over the wiki's Markdown files.
Vorschlag
Add a lightweight, dependency-free BM25 full-text index over
concepts/,entities/, andsummaries/wiki pages, exposed to the query/chat agent as asearch_wiki(query)tool alongsidethe existing
index.md-driven navigation (hybrid retrieval — additive, not a replacement).