Bailian FAISS Knowledge Base for Openclaw

A high-performance local knowledge base skill utilizing FAISS and BM25 for hybrid search powered by Alibaba Cloud Bailian embeddings.

kadbbz
v1.0.1
Apr 13, 2026
1
1.3k
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install rag-kb

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 rag-kb 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 Bailian FAISS Knowledge Base?

The Bailian FAISS Knowledge Base is a sophisticated tool designed for the Openclaw Skills ecosystem to maintain file-based local knowledge repositories. It bridges the gap between raw text extraction and intelligent retrieval by combining FAISS for dense vector search and BM25 for sparse keyword search. This hybrid approach ensures that AI agents can find relevant information with high precision, whether through semantic meaning or specific terminology.

By leveraging Alibaba Cloud's text-embedding-v4 and optional qwen3-rerank models, this skill provides industrial-grade RAG (Retrieval-Augmented Generation) capabilities. It is built to work seamlessly with the Openclaw file processing workflow, consuming extracted chunks and Text-to-Question (T2Q) data to build a robust index that resides entirely on your local infrastructure while only calling external APIs for embedding and reranking tasks.

Bailian FAISS Knowledge Base Use Cases

  • Building a local searchable repository from thousands of technical documents or regulations.
  • Implementing hybrid search (semantic + keyword) to improve retrieval accuracy for AI coding assistants.
  • Managing document versions using timestamped directory structures within Openclaw Skills.
  • Adding protected terms to local indices to ensure specialized industry jargon is correctly indexed for keyword search.
  • Enabling high-precision RAG by reranking initial search results with advanced LLM-based rerankers.

How Bailian FAISS Knowledge Base Works

  1. OpenClaw extracts text from source files and organizes them into chunks, summaries, and T2Q (Text-to-Question) files.
  2. The Python script processes these files, generating 1024-dimensional vectors using the Alibaba Cloud Bailian text-embedding-v4 model.
  3. A semantic index is generated via FAISS and stored locally as index.faiss, while a keyword index is created using BM25 and stored as bm25.json.
  4. When a query is initiated, the skill performs a hybrid search across the specified knowledge base or across all available repositories.
  5. Results from semantic and keyword searches are fused, and if enabled, a reranking step is performed to prioritize the most relevant context for the AI agent.

Bailian FAISS Knowledge Base Setup

To get started with this skill within the Openclaw Skills framework, follow these steps:

# Install the required Python dependencies
python3 -m pip install -r requirements.txt

# Set your Alibaba Cloud Bailian API Key
export BAILIAN_SK="your_api_key_here"

# Verify your environment configuration
python3 scripts/bailian_faiss_kb.py doctor --root-dir /var/openclaw-kb

Bailian FAISS Knowledge Base Data Schema & Taxonomy

The skill follows a strict directory and metadata taxonomy to ensure reliable indexing and retrieval:

File/Folder Purpose Format
summary.txt Single-line summary of the document for quick context. Plain Text
chunks/*.md Semantic text segments used for primary indexing. Markdown
t2q/*.md Generated questions representing the chunk for better recall. Markdown
vectors.jsonl Local cache of generated embeddings and metadata. JSONL
index.faiss The binary vector index for FAISS. Binary
bm25.json Inverted index used for keyword-based retrieval. JSON
protected_terms.json Custom vocabulary to protect specific terms during tokenization. JSON

Bailian FAISS Knowledge Base Advanced Features

  • Hybrid retrieval mode combining semantic FAISS search and BM25 keyword matching for maximum recall.
  • T2Q (Text-to-Question) indexing where questions serve as semantic proxies for content chunks.
  • Support for qwen3-rerank to provide high-precision document ranking.
  • Local management of protected terms to refine the jieba segmentation process.
  • Global query support to search across multiple independent knowledge bases simultaneously.
  • Robust safety boundaries with no background services or listening ports, using only secure HTTPS requests to official API endpoints.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Requires
Bins python3
Github Stars: 0
forks: 0

Featured*