LAUNCH-SUB
LAUNCH-CLAWS
LAUNCH-SUB
LAUNCH-CLAWS
How the Docs System Works
Behind the Scenes
This page explains how the OpenClaw documentation system works internally. It is intended for contributors who want to add or update documentation, and for anyone curious about the technical implementation.
Markdown Files
All documentation is written as Markdown files stored in the repository under:
content/openclaw/docs/
├── en/ # English documentation
│ ├── getting-started/
│ ├── channels/
│ ├── billing/
│ ├── advanced/
│ ├── security/
│ ├── troubleshooting/
│ └── meta/
└── de/ # German documentation
├── getting-started/
├── channels/
├── billing/
├── advanced/
├── security/
├── troubleshooting/
└── meta/
Each documentation page exists as two files: one in en/ and one in de/. Both versions must have the same slug and category.
YAML Frontmatter
Every Markdown file starts with a YAML frontmatter block that defines metadata:
---
title: Page Title
slug: page-slug
category: getting-started
section: Getting Started
position: 3
---
| Field | Required | Description |
|---|---|---|
| title | Yes | Display title of the page (localized) |
| slug | Yes | URL identifier, must match between EN and DE versions |
| category | Yes | Directory name (getting-started, channels, billing, advanced, security, troubleshooting, meta) |
| section | Yes | Display name for the category (localized -- "Advanced" in EN, "Erweitert" in DE) |
| position | Yes | Sort order within the category (lower numbers appear first) |
Category and Section Mapping
| Category (directory) | English Section | German Section |
|---|---|---|
| getting-started | Getting Started | Erste Schritte |
| channels | Channels | Kanäle |
| billing | Billing | Abrechnung |
| advanced | Advanced | Erweitert |
| security | Security | Sicherheit |
| troubleshooting | Troubleshooting | Fehlerbehebung |
| meta | Meta | Meta |
Document Sync Process
Documentation files are synced to the database through the DocumentSyncService. This service:
- Scans the
content/openclaw/docs/directory for Markdown files - Parses YAML frontmatter from each file
- Converts Markdown content to HTML
- Calculates an estimated reading time
- Generates a vector embedding for semantic search
- Stores everything in the
oc_document_embeddingstable
The Sync Flow
Markdown file on disk
→ DocumentSyncService reads the file
→ YAML frontmatter parsed for metadata
→ Markdown body converted to HTML
→ Reading time calculated from word count
→ Text sent to embedding API (4096 dimensions)
→ Record upserted in oc_document_embeddings table
Database Record Fields
Each synced document creates a record with:
| Field | Source |
|---|---|
| file_path | Relative path from Rails root |
| document_type | Always "docs" for documentation |
| locale | "en" or "de" from directory path |
| slug | From frontmatter |
| category | From frontmatter |
| title | From frontmatter |
| content_html | Markdown converted to HTML |
| readingtimeminutes | Estimated from word count |
| embedding | 4096-dimension vector from EmbeddingClient |
Semantic Search with pgvector
The documentation system uses PostgreSQL's pgvector extension to enable semantic search. When a user asks a question, the system:
- Converts the question into a vector embedding using the same embedding model
- Queries the
oc_document_embeddingstable using vector similarity search - Returns the most relevant documentation pages ranked by similarity
This means users can find documentation by describing what they are looking for in natural language, rather than needing to know exact keywords or page titles.
How Vector Search Differs from Text Search
Text search finds exact or fuzzy word matches. Searching for "server won't start" would only find pages containing those specific words.
Vector search understands meaning. Searching for "server won't start" would also find pages about "instance not running" or "deployment failure" because the concepts are semantically similar.
Linking Between Pages
Documentation pages link to each other using the /docs/slug format:
See the [Architecture Overview](/docs/architecture) for more details.
The slug in the URL must match the slug field in the target page's frontmatter. Links work across locales -- the system resolves the correct localized version based on the reader's language setting.
Adding New Documentation
To add a new documentation page:
- Create the English file in the appropriate category directory
- Create the German file in the matching DE category directory
- Set matching slugs -- Both files must have the same
slugvalue - Choose a position -- Pick a number that places the page in the correct sort order within its category
- Write the content -- Use standard Markdown with headings, tables, code blocks, and lists
- Add a Related Docs section -- Link to other relevant pages at the bottom
File Naming Convention
Use the slug as the filename with a .md extension:
content/openclaw/docs/en/advanced/my-new-page.md
content/openclaw/docs/de/advanced/my-new-page.md
Both files would have slug: my-new-page in their frontmatter.
Content Guidelines
- Write in clear, direct language
- Use headings to organize content (start with
##, not#) - Include code examples where helpful
- Add tables for comparing options or listing configurations
- End each page with a "Related Docs" section linking to related pages
- Do not include unverifiable claims or made-up statistics
German Translation Notes
The German version should be a natural German translation, not a word-for-word conversion:
- Use proper German umlauts (ä, ö, ü, ß), never ae, oe, ue, ss substitutions
- Localize the
titleandsectionfields - Keep technical terms (Docker, API, SSH) unchanged
- Translate code comments if they contain user-facing text
- Use "du" (informal) for addressing the reader
Testing Documentation
Each documentation page has an associated RSpec test that verifies:
- The Markdown file exists at the expected path
- Frontmatter contains all required fields with correct values
- The file syncs successfully through DocumentSyncService
- The database record has the correct locale, slug, category, and content
Tests are located in spec/services/openclaw/docs_content/ and follow a consistent pattern for all documentation pages.
Related Docs
- Architecture Overview -- Technical architecture of the platform
- Best Practices -- Recommendations for using OpenClaw effectively
Related Documentation
Embedding/RAG Add-on
What the Embedding Add-on Does The embedding add-on enables Retrieval-Augmented Generation (RAG)...
OpenClaw Configuration Reference
What openclaw.json Does The openclaw.json file is the main configuration file for your OpenClaw ...
What is OpenClaw?
An Open-Source AI Assistant You Can Self-Host OpenClaw is an open-source framework for running y...