cairn for Openclaw

cairn is a local-first hybrid indexing tool that combines full-text search, vector embeddings, and AST-based knowledge graphs into a single SQLite file for AI agent grounding.

mrsirg97-rgb
v1.2.2
May 12, 2026
0
706
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install cairn

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install cairn using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is cairn?

cairn is a sophisticated local hybrid index designed for developers who need to provide AI agents with high-fidelity, private grounding data. Unlike broad crawlers, it focuses on intentional collection—allowing you to curate and ingest codebases, design docs, PDFs, and web pages into a unified SQLite-backed store. By integrating FTS5, vector search, and an AST-driven knowledge graph, it provides five distinct query surfaces for complex retrieval tasks.

As a standout among Openclaw Skills, cairn prioritizes privacy and performance. It operates with zero network egress (except for explicit URL additions) and offers an embedded runtime that requires no external daemons. This makes it an ideal choice for secure local development environments where models need to navigate deep technical relationships like code dependencies or architectural mitigations without relying on third-party cloud indexes.

cairn Use Cases

  • Providing AI agents with local-first retrieval grounding for private codebases and sensitive documentation.
  • Executing hybrid searches that combine keyword relevance (FTS5) with semantic meaning (vector embeddings).
  • Mapping code structures using tree-sitter AST extraction to help models understand function calls and dependencies.
  • Performing shortest-path analysis between code entities to debug complex system architectures.
  • Organizing research and audit notes via LLM-emitted tags for structured discovery and filtering.

How cairn Works

  1. Curation: The user or AI agent identifies specific high-value sources (folders, files, or URLs) to be indexed.
  2. Ingestion: The system parses the content using specialized extractors (tree-sitter for code, unpdf for docs, linkedom for web) to create text chunks and entities.
  3. Indexing: Chunks are processed into FTS5 for keyword search and vector embeddings for semantic search; meanwhile, the knowledge graph builds edges between entities.
  4. Storage: All data, including the graph topology and embeddings, is stored in a single, portable SQLite file on the local disk.
  5. Retrieval: AI models access the index via the MCP (Model Context Protocol) server to perform hybrid searches, graph queries, or shortest-path analysis.

cairn Setup

You can quickly add this to your project using the following steps. Ensure you have Node.js 20 or higher installed.

# Install the package
npm install cairn-index@^1.1.0

# Standard setup (requires Ollama for embeddings)
cairn add ./src --label my-project

# Optional: Run in embedded mode (no daemon required)
export CAIRN_RUNTIME=embedded
cairn add ./docs --label docs

# Start the MCP server for AI agent integration
cairn-mcp

cairn Data Schema & Taxonomy

cairn organizes data into a relational structure within SQLite, ensuring high-speed retrieval and integrity. The following table describes the primary components of the schema:

Table Description
sources Tracks the root ingestion points and their metadata.
files Individual files associated with an indexed source.
chunks Text segments indexed with FTS5 and vector embeddings.
entities Logical units like functions, structs, or concepts with vector support.
edges Relationships between entities (e.g., calls, depends_on, mitigates).
tags Free-form LLM-emitted labels for granular filtering.

FK cascades and triggers are utilized to keep vector indexes in sync during refreshes.

cairn Advanced Features

  • Hybrid Search (RRF): Fuses FTS5 and vector results using Reciprocal Rank Fusion for superior ranking.
  • AST Knowledge Graph: Automatically extracts code relationships using tree-sitter grammars for high-accuracy dependency mapping.
  • Cross-Source Linking: Connects related but separate sources, such as an SDK and the program it interacts with.
  • Dual Runtimes: Seamlessly switch between a local Ollama daemon or a fully embedded in-process runtime via node-llama-cpp.
  • MCP Toolset: Comprehensive Model Context Protocol support allowing models to perform ask, path, and graph operations autonomously.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*