Overview
Large Language Models are transforming how knowledge bases are built, maintained, and queried. This page covers architectures and patterns for AI-powered documentation systems that evolve autonomously, including Svelte 5 integration for interactive UIs.
Architecture Patterns
1. Self-Discovering Documentation
A self-discovering docs site uses AI to:
- Research topics automatically via web search APIs
- Generate structured markdown with proper metadata
- Evolve content on a schedule (daily/weekly via cron)
- Surface new topics through a searchable dashboard
The LLM-Wiki implementation:
Cron (03:00 daily) → research-automation.py → content/topics/*.md → hugo build → Nginx
2. RAG for Documentation
Retrieval-Augmented Generation over a docs site:
- Index: Hugo builds the site; content is the corpus
- Embed: LLM generates embeddings for each page
- Retrieve: Vector search finds relevant pages for a query
- Generate: LLM synthesizes answers from retrieved context
Tools: ChromaDB, Pinecone, Weaviate, or local SQLite-vec.
3. Structured Output from LLMs
When generating documentation content with LLMs:
- Enforce YAML front matter with proper arrays (not comma strings)
- Use short date formats (
2006-01-02) for JSON compatibility - Require
.RelPermalinkfor portable links - Validate tag arrays:
tags: ["ai", "docs"]nottags: ["ai, docs"]
4. Evolution Strategies
| Strategy | Frequency | Trigger |
|---|---|---|
| Full research scan | Daily | Cron schedule |
| Content freshness check | Weekly | Date comparison |
| Link validation | Weekly | Build-time check |
| Tag consolidation | Monthly | Manual review |
5. Svelte 5 Interactive Layer
Add interactive AI features via Svelte 5 components:
<!-- components/AISearch.svelte -->
<script>
let query = $state('');
let results = $state([]);
let loading = $state(false);
async function search() {
loading = true;
const res = await fetch('/api/search?q=' + encodeURIComponent(query));
results = await res.json();
loading = false;
}
</script>
<div class="ai-search">
<input bind:value={query} placeholder="Ask the docs..." />
<button onclick={search} disabled={loading}>
{loading ? 'Searching...' : 'Search'}
</button>
<ul>
{#each results as r}
<li><a href={r.url}>{r.title}</a></li>
{/each}
</ul>
</div>Integration with Hugo:
- Build Svelte 5 components as IIFE modules via Vite
- Include via Hugo shortcode:
`{{%/* svelte "AISearch" */%}}` - Hugo serves static content; Svelte handles interactivity
Implementation: LLM-Wiki
The LLM-Wiki site itself is the reference implementation:
- Hugo for static generation (zero Node.js dependency)
- Vanilla JS dashboard (no Svelte/Vite build)
- Python research script for automated content
- Nginx for serving with SSL
Key design decisions:
- Single-site architecture (no separate dashboard build)
- JSON feed as the API layer between Hugo and dashboard
- Cron-driven evolution (no real-time complexity)
Svelte 5 + RAG Integration
<!-- components/RAGChat.svelte -->
<script>
import { createSubscriber } from 'svelte/reactivity';
let messages = $state([]);
let input = $state('');
let streaming = $state(false);
// Subscribe to external SSE/WebSocket for streaming
const streamSubscriber = createSubscriber(() => {
// React to stream updates
});
async function send() {
streaming = true;
messages.push({ role: 'user', content: input });
input = '';
const res = await fetch('/api/rag', {
method: 'POST',
body: JSON.stringify({ query: messages[messages.length - 1].content })
});
for await (const chunk of res.body) {
const text = new TextDecoder().decode(chunk);
messages[messages.length - 1].content += text;
streamSubscriber();
}
streaming = false;
}
</script>
<div class="chat">
{#each messages as msg}
<div class="msg {msg.role}">{msg.content}</div>
{/each}
{#if streaming}<span class="cursor">▌</span>{/if}
<input bind:value={input} onkeydown={e => e.key === 'Enter' && send()} />
</div>Related Topics
- Hugo Documentation Automation
- Self-Discovering Documentation
- AI Content Evolution
- Svelte 5 Best Practices
- Svelte 5 Migration Guide
Evolution Notes
Content last updated: 2026-06-05 Next review: 2026-06-12