Skip to content

praneybehl/llm-wiki-plugin / skills/llm-wiki

llm-wiki

Verified

Build and maintain an LLM-curated knowledge base from papers, articles, transcripts, notes and project findings. Ingest sources into linked Markdown, answer questions with citations, lint or upgrade a wiki, and preserve useful synthesis across sessions and agents. Also capture verified task experience, consolidate success/failure patterns, and propose, evaluate, apply or roll back evidence-linked skill improvements. Trigger on "add this to my wiki", "what does the wiki say", "learn from this task", "improve this procedure", /wiki:learn or /wiki:evolve. Works on a local folder or a hosted wiki URL (MCP). Use index-first navigation, atomic pages and hybrid search.

FileKindSize
SKILL.mdskill md24.6 KB
assets/SCHEMA.md.templateother7.4 KB
assets/decision-questions.jsonconfig3.1 KB
assets/evolution_README.md.templateother2.3 KB
assets/experience.json.templateother660 B
assets/graph_README.md.templateother2.0 KB
assets/graph_gitignore.templateother27 B
assets/index.md.templateother775 B
assets/log.md.templateother499 B
assets/ontology.yaml.templateother3.2 KB
assets/page.md.templateother805 B
assets/pattern.md.templateother839 B
assets/wiki-cache_gitignore.templateother14 B
references/agent-memory-integration.mdmarkdown7.5 KB
references/architecture.mdmarkdown9.6 KB
references/decision-models.mdmarkdown6.5 KB
references/evolution-workflow.mdmarkdown19.7 KB
references/graph-workflow.mdmarkdown7.1 KB
references/hosted-mode.mdmarkdown11.4 KB
references/ingest-workflow.mdmarkdown11.1 KB
references/lint-workflow.mdmarkdown8.3 KB
references/page-conventions.mdmarkdown5.8 KB
references/query-workflow.mdmarkdown8.6 KB
references/retrieval-setup.mdmarkdown5.6 KB
references/scaling-playbook.mdmarkdown6.8 KB
scripts/init_wiki.pyscript9.5 KB
scripts/setup_wiki.pyexecutablescript2.5 KB
scripts/test_link_resolution.pyscript6.2 KB
scripts/wiki_decide.pyexecutablescript31.6 KB
scripts/wiki_evolve.pyscript29.1 KB
scripts/wiki_evolve_agent.pyscript15.1 KB
scripts/wiki_evolve_api.pyscript7.0 KB
scripts/wiki_evolve_claude.pyscript2.4 KB
scripts/wiki_evolve_loop.pyscript43.4 KB
scripts/wiki_evolve_stream.pyscript13.0 KB
scripts/wiki_graph_extract.pyscript21.0 KB
scripts/wiki_graph_lint.pyscript22.0 KB
scripts/wiki_graph_query.pyscript9.3 KB
scripts/wiki_lint.pyscript14.5 KB
scripts/wiki_remote.pyexecutablescript76.6 KB
scripts/wiki_search.pyscript35.9 KB
scripts/wiki_stats.pyscript5.9 KB

references/query-workflow.md

View on GitHub
# Query Workflow

The user is asking a question against the wiki. The job is to answer it from the wiki, with citations, scaling navigation to the wiki's size, and to file the answer back as a synthesis page when warranted.

## Step 0: Check the schema

Read `wiki/SCHEMA.md` if you haven't this session. Some wikis declare query-specific conventions (e.g. "always answer with a comparison table when the question is comparative", "answers go in `wiki/synthesis/qa/` not `wiki/synthesis/`"). Schema overrides defaults.

Each step shows the local form first. For a hosted wiki, use the **Hosted** form (see `hosted-mode.md`). **Hosted:** call `wiki_overview`. It returns `SCHEMA.md` and `index.md`.

## Step 1: Read the index

Always start at `wiki/index.md`. If the index has been sharded into `wiki/indexes/`, read the top-level `index.md` first to identify which shard(s) are relevant, then read those.

The index is engineered for this: one line per page with a tight summary. You should be able to identify candidate pages from the index alone in most cases. If a query touches multiple shards (e.g. "compare the methodologies in papers A and B"), read all relevant shards.

## Step 2: Identify candidate pages

From the index, build a short list of pages that look relevant to the query. Be selective: reading 30 pages to answer a question is a sign you've fallen back to brute-force search, which doesn't scale. If the index summaries don't disambiguate well, that's a signal that the index entries are too terse: note it for the next lint pass.

If the index doesn't surface good candidates (the query uses fuzzy or domain-specific language that doesn't match the index summaries), fall back to the search script:

```bash
uv run --script scripts/wiki_search.py "your query terms" --top 10 --cache --json
```

This returns section-level hybrid results by default: local FastEmbed semantic ranking and BM25 are fused with RRF, and each JSON row carries its `heading_path`, snippet, and retrieval provenance. The first semantic run downloads the pinned model; section vectors live in `wiki/.wiki-cache/embeddings.sqlite` and only changed sections are re-embedded. No wiki or query text leaves the machine. For dependency-free lexical BM25, run `python scripts/wiki_search.py "your query terms" --no-embed`; use optional frontmatter filters (`--type concept`, `--tag llms`, `--since 2026-01-01`) or pass `--granularity page` for whole-page lexical ranking.

**Hosted:** call `wiki_search` with `query`, `top` and the same optional filters (`type`, `tag`, `since`, `granularity`). The rows have the same shape. A response with `vector_lag` above 0 means that some new sections are searchable by keyword only.

If the user enabled the optional decision layer, add `--decide` (local) or `decide: true` (hosted). The gate removes rows that only share words with the query. An empty gated result means that the wiki probably has no answer. If the result reports `failed_open: true`, the gate did not run. See `decision-models.md`.

## Step 2b: Graph-assisted lookup (only if `wiki/graph/graph.sqlite` exists)

For relational questions ("what's connected to X", "who proposed Y", "trace the path from A to B"), query the compiled graph after the index pass and before reading pages:

```bash
python scripts/wiki_graph_query.py wiki/ neighbors --node <node-id>
python scripts/wiki_graph_query.py wiki/ facts    --about <node-id>
```

Use the structured neighbors/facts to pick the right wiki pages to read, but never answer from graph rows alone for high-stakes claims. The graph accelerates navigation; the wiki page and its raw source remain the evidence. If `graph.sqlite` is older than the most recent `## [YYYY-MM-DD] ingest |` entry in `log.md`, regenerate first with `wiki_graph_extract.py`. Full reference: `references/graph-workflow.md`.

**Hosted:** call `wiki_graph` with the same operation (`neighbors`, `facts`, `edges`, `path`). The server graph is always current.

## Step 3: Read the candidate pages

Read each candidate page in full (**Hosted:** `wiki_read` with one or more `paths`, or a `heading` for one section). While reading, note any `[[wikilinks]]` to other pages that look relevant: those are pre-curated leads. Follow the most promising ones, but don't recursively chase every link or you'll exhaust your context window on tangentially-relevant pages.

If a page references a source-summary page in its frontmatter and the answer hinges on what that source actually said, read the source-summary page too. Avoid going all the way back to the raw source unless the wiki summaries are clearly insufficient: the whole point of the wiki is that the synthesis is already done.

## Step 4: Find backlinks if needed

If the query is "what does my wiki say about X" or "where is X mentioned", and X has its own page, the inbound links are often more interesting than the page itself. Find them with:

```bash
grep -rl "\[\[<page-slug>\]\]" wiki/
```

This is faster than reading pages to look for mentions. Note that the bundled `wiki_search.py` has a `--backlinks <slug>` mode that does this and returns ranked results.

**Hosted:** call `wiki_search` with `backlinks: "<page-slug>"`.

## Step 5: Synthesize the answer

Write the answer in your own words, with `[[wikilink]]` citations to the wiki pages you used and (where helpful) `raw/<file>` references to specific raw sources. The citations matter: they let the user verify the answer and follow up.

If the wiki contains contradicting claims, surface the contradiction explicitly rather than picking one and presenting it as settled. The wiki's value is partly in tracking what's known versus what's contested.

If the wiki has no relevant content for the query, say so plainly. Do not confabulate: that's the surest way to corrupt the wiki when the answer gets filed back. Instead, suggest sources the user could ingest to fill the gap.

## Step 6: Offer to file the answer back

If the synthesized answer represents new connection-making (a comparison the wiki didn't already contain, an analysis that pulls together threads from multiple pages, an answer to a recurring question), offer to file it as a synthesis page. The user will say no for trivial answers and yes for substantive ones. Default to offering.

The file-back creates `wiki/synthesis/<answer-slug>.md` with frontmatter:

```yaml
---
type: synthesis
question: "the original question, verbatim or lightly cleaned"
asked: 2026-04-15
sources_consulted: [page-1, page-2, page-3]
tags: [...]
---
```

Body: the answer as you gave it to the user, possibly lightly edited for the wiki's voice. Add the new synthesis page to the relevant index. Append to `log.md` with prefix `## [YYYY-MM-DD] query | <question-summary>`.

**Hosted:** use one `wiki_commit` with a `create` operation for the synthesis page, an `append` operation for the index line and an `append` operation for the `log.md` line.

A filed synthesis page is itself queryable: the next time the user asks an adjacent question, the synthesis page may be the most relevant candidate. This is how exploration compounds.

## Special query types

**"What's missing on topic X?"**: Read existing pages on X, identify open questions or unstated assumptions, and propose ingest candidates. This is essentially a per-topic micro-lint.

**"Compare X and Y"**: Read both pages, look for explicit comparison pages already in `synthesis/`, generate a comparison table or contrast prose. Strong file-back candidate.

**"Show me the timeline of X"**: Use `log.md` to reconstruct chronology of ingests touching X, supplement with `created`/`updated` frontmatter on relevant pages.

**"What did source X say about Y?"**: Read `wiki/sources/<x>.md` for the source's summary; if it doesn't directly answer, read `raw/<x>` (chunk-read if large).

**"Lint check on this answer"**: Before filing back, ask the user to verify a key claim by pointing to its raw source. Especially valuable for high-stakes wikis (medical, legal, financial).

## Anti-patterns to avoid

**Reading every page in the wiki to be safe.** This doesn't scale and produces vague answers. Trust the index; if the index fails, fix the index, don't bypass it.

**Citing the wiki without citing the underlying sources for hard claims.** The wiki page is a paraphrase; for any claim the user might need to verify, the citation should chain back to the raw source.

**Filing back trivial answers.** Not every Q&A is worth a permanent page. If the answer is a one-line lookup or restates an existing page, don't pollute synthesis/. The threshold is "would I want to find this when I ask a similar question in three months?"

**Confabulating when the wiki is silent.** Better to say "the wiki doesn't cover this" than to invent an answer that gets filed back as authoritative.
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall