# Ask Wiki

> Query the LLM wiki to generate insights, research briefings, or answer questions. Synthesizes knowledge across the wiki/ folder and saves the outputs to output/ while also updating relevant wiki pages with the new insights.

- Skill: `jlbgit/ask-wiki` (Agent Skill)
- Install (CLI): `npx skillmds@latest add jlbgit/ask-wiki`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jlbgit/ask-wiki/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: jlbgit (https://skillmd.com/u/jlbgit)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/jlbgit/ask-wiki

---


# Ask Knowledge Base Wiki

This skill formalizes the "Question -> Answer -> Save" loop. It instructs the AI to treat the `wiki/` directory (as defined by `AGENTS.md`) as its sole truth and automatically save generated insights so they compound over time.

## Instructions

When the user asks a question, requests a briefing, or asks you to find gaps in the knowledge base using this skill:

0. **Resolve Paths (always do this first):**
   First, check if a `wiki-config.md` exists in the current workspace root
   (this indicates a project-local wiki). If not found, read
   `wiki-config.md` from the same directory as this skill (e.g.,
   `~/.cursor/skills/wiki-config.md`) for the global wiki. The file
   contains four absolute paths labelled **Wiki root**, **Wiki folder**,
   **Raw folder**, and **Output folder**. Use these paths everywhere below
   instead of the relative `wiki/`, `raw/`, and `output/` defaults.
   If neither file exists, fall back to relative paths from the workspace root.

1. **Explore the Knowledge Base (Graph Traversal):**
   - **Start Token-Efficiently:** First, scan `wiki/index.md` to identify the entry-point nodes (topics) directly relevant to the user's query.
   - **Traverse the Knowledge Graph:** Read the entry-point `.md` files in `wiki/` (which may live in thematic subfolders like `wiki/Building Energy/`) and follow their internal `[[wiki-links]]` to navigate to related concepts. Obsidian resolves links regardless of subfolder, so search for the target filename across all subfolders. Follow links instead of blindly searching the entire `wiki/` directory, staying within the cluster relevant to the query (e.g., a query about "Token Optimization" should not touch "HVAC Control" pages). Apply these traversal rules:
     - **Summary-first reading:** For pages **over ~100 lines**, read only the extended summary (opening paragraphs before the first `##` section) and decide whether the full page is relevant before reading the rest. For shorter pages (≤100 lines), read the full page — the token savings from a partial read are negligible and the extra tool call to fetch the remainder is wasteful.
     - **Prioritize by relevance:** When a page has multiple outgoing `[[wiki-links]]`, follow the link whose topic name is most semantically related to the query first. Skip links that clearly diverge from the query's scope.
     - **Track visited pages:** Keep a mental set of pages already read. Never re-read a page you have already visited, even if you encounter a link back to it.
     - **Dead-end handling:** If the current page's outgoing links all point to already-visited pages or clearly irrelevant topics, do not force further traversal from this path. Return to the index and try the next most relevant entry-point topic that has not yet been visited. This prevents wasting reads on tangential content.
     - **Depth limit:** Stop traversing after visiting **~8–10 pages** (or sooner if new pages add diminishing context). The wiki is the *summary layer* — exhaustive reading defeats its purpose.
   - **Optional Deep-Dive into Raw Sources:** After the wiki traversal is complete, assess whether the wiki content alone is sufficient to answer the query. If — and only if — the wiki pages lack detail, contain "[citation needed]"-style gaps, or the user explicitly asks for primary-source grounding, review the Sources sections of visited pages and select up to **5** `raw/` files most relevant to the query. To locate raw files, glob-search the `raw/` folder by keywords from the source title (raw filenames match paper/article titles with special characters replaced). This two-phase approach (cheap wiki scan first, targeted raw reads only when needed) keeps token usage efficient while still allowing primary-source grounding when it matters.

2. **Generate the Insight / Answer:**
   Synthesize an answer using the facts contained within the `wiki/` folder and, if necessary, their original sources in `raw/`. Do not hallucinate external knowledge. If the answer cannot be found in your sources, clearly state that the knowledge base lacks information on the topic.

3. **Include References:**
   At the end of every generated answer or briefing, you MUST include a "References" section. This section should list and link to all the original source documents (from the `raw/` folder or cited in the wiki) that were used to compile the answer.

4. **Save to Outputs:**
   Save the full generated response (including the References section) as a new `.md` file inside the `output/` directory (e.g., `output/Briefing - Agentic AI Workflows.md`).

5. **Re-integrate (Compound) the Knowledge:**
   If the generated answer uncovers a new connection, a synthesized insight, or a newly discovered gap, **update the relevant pages** back in the `wiki/` directory.
   - For example, if the user asks you to compare Source A and Source B on a specific topic, and you find a novel insight, add a "Synthesized Insights" section to that topic's `.md` page in `wiki/`.
   - This ensures that every question asked makes the knowledge base permanently smarter for future queries.

6. **Log the Query:**
   Append a row to `wiki/log.md` recording the timestamp, the query asked, and which wiki pages were updated during re-integration (if any). This keeps the log as the single audit trail for all wiki modifications.

## Example Queries
- "What are the three biggest gaps in my understanding of Agentic AI?"
- "Compare what the wiki says about RAG vs LLM Wikis. Where do they disagree?"
- "Write me a 500-word briefing on HVAC control using only what's in this knowledge base."
