Skip to main content
OpenGround is an on-device RAG (Retrieval-Augmented Generation) system designed to give AI agents controlled access to documentation. Everything runs locally - no external APIs, no data leaves your machine.

System Overview

OpenGround follows a pipeline architecture with three main stages:

Architecture Stages

1. Source Layer

The source layer handles documentation ingestion from multiple source types. See the Sources page for detailed information. Supported Sources:
  • Git Repositories: Clone and extract documentation from specific branches/tags
  • Sitemaps: Crawl and extract web documentation following sitemap.xml
  • Local Paths: Process documentation from local directories
Key Components:
  • extract/git.py: Handles git repository cloning with sparse checkout
  • extract/sitemap.py: Fetches and parses sitemaps, respects robots.txt
  • extract/local_path.py: Processes local file system paths
  • extract/common.py: Shared file processing logic

2. Processing Layer

The processing layer transforms raw documentation into searchable chunks.

Text Extraction

OpenGround supports multiple documentation formats:
Supported file types: .md, .mdx, .rst, .txt, .ipynb, .html, .htm

Document Chunking

Documents are split into overlapping chunks for better retrieval (from ingest.py:52-76):
Chunk overlap ensures that context isn’t lost at chunk boundaries, improving retrieval quality.

Embedding Generation

Each chunk is converted to a vector embedding using a local model. See Embeddings for details.

3. Storage Layer

OpenGround uses LanceDB for storing both vector embeddings and full-text search indices.

Why LanceDB?

  • Columnar storage: Efficient for vector operations
  • Built-in BM25: Full-text search without external dependencies
  • Local-first: No server setup required
  • PyArrow integration: Fast data serialization

Schema Structure

From ingest.py:163-177, the LanceDB table schema:
The schema metadata tracks which embedding model was used, preventing incompatible searches.

Full-Text Index

After ingesting chunks, OpenGround creates a BM25 full-text search index (from ingest.py:223-226):
This enables hybrid search combining semantic similarity and keyword matching.

4. Query/Client Layer

The client layer exposes documentation through two interfaces:

CLI Commands

MCP Server

The Model Context Protocol (MCP) server exposes OpenGround to AI agents:
AI agents can search documentation without polluting the main conversation context.

Data Flow Example

Let’s trace a complete flow from adding documentation to searching it:
1

Add Documentation

  1. Git extractor clones repo with sparse checkout
  2. Filters for .md, .mdx files in docs/
  3. Extracts content and metadata
  4. Saves to ~/.local/share/openground/raw_data/fastapi/v0.100.0/
2

Chunk & Embed

  1. Load parsed pages from raw_data directory
  2. Split each page into 800-character chunks with 200-char overlap
  3. Generate embeddings for all chunks (batch size: 32)
  4. Store in LanceDB with metadata
3

Search

Returns ranked results combining semantic similarity and keyword relevance.

Configuration

OpenGround’s behavior is controlled through a hierarchical configuration system (from config.py):

XDG Compliance

OpenGround follows the XDG Base Directory Specification (from config.py:10-24):
  • Config: $XDG_CONFIG_HOME/openground or ~/.config/openground
  • Data: $XDG_DATA_HOME/openground or ~/.local/share/openground
  • Windows: Uses AppData/Local/openground

Component Isolation

Each component is designed for independence:
  • Extractors output standardized ParsedPage objects
  • Ingestion works with any ParsedPage source
  • Query operates on LanceDB tables regardless of source
  • Embedding backends are swappable (sentence-transformers ↔ fastembed)
This modularity enables:
  • Adding new source types without changing ingestion
  • Swapping embedding models without changing extraction
  • Independent testing of each component

Next Steps

Sources

Learn how OpenGround extracts documentation from git, sitemaps, and local paths

Embeddings

Understand embedding backends, models, and dimensions

Search

Deep dive into hybrid search with vector similarity and BM25

Configuration

Customize OpenGround’s behavior with config options