# G2P WikiLLM

A knowledge base for OpenG2P, structured for consumption by an LLM-based assistant — the [G2P Advisor](https://github.com/OpenG2P/g2p-advisor-v2).

The wiki is built **once at ingest time** from authoritative sources (the OpenG2P GitBook documentation, GitHub repositories under [github.com/OpenG2P](https://github.com/OpenG2P), and the OpenG2P website) into a graph of cross-referenced markdown pages. The advisor reads these pages at runtime; it does not perform vector retrieval against raw text.

The repository lives at [github.com/OpenG2P/g2p-wiki](https://github.com/OpenG2P/g2p-wiki).

## What is here

* `raw/` — immutable mirrors of the source material (GitBook docs, GitHub repos, website snapshot).
* `wiki/` — LLM-built, cross-referenced markdown pages: concepts, entities, source summaries, comparisons, playbooks.
* `lessons/` — admin-curated, anonymised digests promoted from advisor sessions.
* `tools/` — ingest, synthesis, and lint scripts.

## Why this exists

Implementers, integrators, and government departments adopting OpenG2P need accurate, grounded answers from a single trusted surface. Vector-retrieval-only RAG systems often hallucinate because they search loose chunks of text without a stable structure. WikiLLM compiles the knowledge once into a curated graph, so the assistant reads from the same place every time and every claim can be traced back to its source.

The [G2P Advisor (v2)](https://github.com/OpenG2P/g2p-advisor-v2) is the primary consumer:

* In **chat mode**, it reads `wiki/index.md`, drills into relevant pages, and synthesises an answer with `[[wiki-link]]` citations and links back to GitBook.
* In **project mode**, it walks an implementer through phased implementation using the **playbook** pages in the wiki (e.g. the Registry use-case-implementation playbook) as the operating contract.

The advisor reads the wiki; it never queries GitBook or GitHub directly.

## Sub-pages

* [Concept — WikiLLM](/tools/g2p-wikillm/concept.md) — Karpathy's idea and what we adopted from it.
* [Design](/tools/g2p-wikillm/design.md) — sources, folder structure, page types, conventions.
* [CLAUDE.md vs wiki/index.md](/tools/g2p-wikillm/claude-md-vs-index.md) — the two index-like files in the repo and how they differ.
* [Scripts](/tools/g2p-wikillm/scripts.md) — ingest, synthesise, lint, update — what each does and how to run it.
* [Roadmap & Automation](/tools/g2p-wikillm/automation-todo.md) — open TODOs and the plan for automatic updates when sources change.

## Editing rules

* Do **not** edit `raw/` by hand. It is overwritten by ingest jobs.
* Do **not** edit `wiki/` by hand. It is regenerated by synthesis jobs.
* Curated edits belong in `lessons/` (via PR), or upstream in the source — for example, in the `openg2p-documentation` repo for GitBook content.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.openg2p.org/tools/g2p-wikillm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
