Files
Leo af6a11d1df Add English workflow + n8n template submission text
- workflows/LLM_wiki.en.json: English, credentials/IDs scrubbed for template submission
- templates/SUBMISSION.md: title, description and checklist for n8n.io

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 18:30:49 +08:00

80 lines
4.8 KiB
Markdown

# n8n Template Submission — LLM Wiki
Workflow file to submit: [`workflows/LLM_wiki.en.json`](../workflows/LLM_wiki.en.json)
Submit at: <https://n8n.io/creators/> → **Submit a workflow** (you must be signed in to your n8n.io creator account).
---
## Title
**LLM Wiki: pre-compiled RAG with an AI editor, using Google Docs & Sheets**
## Short description (one-liner)
A different take on RAG: instead of embedding-and-retrieve, an LLM acts as a "wiki editor" that reads, rewrites and cross-links your documents into a structured knowledge base — then answers questions by looking things up in an index, like a human would.
## Full description
This workflow implements Andrej Karpathy's **LLM Wiki** idea in n8n, using tools everyone already has — **Google Docs** for the wiki pages and **Google Sheets** as the index. No vector database required.
### The idea — "pre-compile" instead of "embed-and-retrieve"
Traditional RAG shreds your documents into chunks, embeds them, and at query time pulls a few chunks for the LLM to read. The model only ever sees those fragments — it has no global view.
LLM Wiki does the opposite. It **pre-compiles** your raw material: the LLM reads everything and, like a Wikipedia editor, organizes, rewrites and cross-links it into clean wiki pages. To find an answer it first consults an **index** (just like a person looking something up), then reads the relevant page. The result is a curated **knowledge base**, not an ever-growing **knowledge warehouse** — similar material gets *updated* into existing pages rather than piled up as new chunks.
| | Classic vector RAG | LLM Wiki (this template) |
|---|---|---|
| Ingestion | chunk → embed → store vectors | LLM reads → rewrites → wiki page |
| Retrieval | vector similarity | look up the **index** |
| Growth | unbounded (warehouse) | curated, updated in place (library) |
| Source docs | shredded directly | kept as single source of truth |
### What's inside
The workflow has **two independent flows**:
1. **Ingest (write).** A form upload (`.md` / `.txt`) feeds an **AI Agent ("knowledge-writing assistant")**. It always reads the index first, splits the upload into topics, then for each topic either **appends** to an existing Google Doc and updates the index, or **creates** a new Doc and adds an index row.
2. **Query (read).** A chat trigger feeds an **AI Agent ("knowledge-query assistant")** that browses the index, picks the most relevant page(s), reads them, and answers — read-only, grounded in the wiki.
### Tools used by the agents
- `get_indexs` — read the index sheet (topic, doc_id, keywords, summary)
- `create_wiki_page` — create a new Google Doc (via an HTTP call to a tiny companion sub-workflow, because the Docs node can't create a file directly inside a target folder)
- `write_wiki` / `update_wiki` — append/update a wiki Doc
- `write_index` — add a new index row
- `read_wiki` — read a wiki Doc's full text
> **Companion sub-workflow.** This template needs a small second workflow (`create_wiki_page`) that creates a Doc and moves it into your wiki folder, exposed as a webhook. It's included in the GitHub repo linked below.
### Setup
1. Import the workflow.
2. Create a Google Sheet for the **index** with columns: `topic`, `doc_id`, `keywords`, `summary`, `last_updated`. Point the `get_indexs` / `write_index` nodes at it (replace the `YOUR_INDEX_SHEET_ID` placeholder).
3. Import the companion `create_wiki_page` sub-workflow and set its target folder; put its webhook URL into the `create_wiki_page` HTTP node (replace `YOUR-N8N-HOST/...`).
4. Attach your own credentials to the Google Sheets / Docs nodes and your LLM node (this template uses **Google Gemini**; swap in any chat model).
5. Activate, upload a doc, then ask a question in the chat trigger.
### Notes & credits
- This burns more tokens than vector RAG (the LLM actually reads and rewrites your material) — but the curation quality is the point.
- Concept by **Andrej Karpathy** ([original gist](https://gist.github.com/karpathy/442a6bf555914893e9891c11ac484894)). This template just swaps Obsidian for Google Docs + Sheets so anyone can run it.
- Full repo, the companion sub-workflow, a sample index and a sample wiki page: **<https://github.com/uncle6me-web/LLM-Wiki-for-n8n>**
## Suggested categories / tags
AI, RAG, Agent, Google Docs, Google Sheets, Knowledge Base, Gemini
---
## Pre-submission checklist
- [x] All user-facing strings translated to English
- [x] Credentials removed (importers attach their own)
- [x] Personal Sheet ID replaced with `YOUR_INDEX_SHEET_ID`
- [x] Personal n8n webhook URL replaced with `YOUR-N8N-HOST/...`
- [x] Instance metadata (`id`, `versionId`, `webhookId`, `tags`, `pinData`) cleared
- [ ] Companion `create_wiki_page` sub-workflow imported & its webhook URL filled in
- [ ] Tested end-to-end on your own n8n before submitting