Install
openclaw skills install @jason-aka-chen/meta-knowledge-baseAI-powered knowledge base builder that automatically captures, organizes, and retrieves information. Learns from conversations, documents, and interactions to build a personalized knowledge graph. Enables semantic search and intelligent Q&A.
openclaw skills install @jason-aka-chen/meta-knowledge-baseSelf-building knowledge management system that learns and grows automatically.
pip install numpy faiss-cpu sentence-transformers
from meta_knowledge import KnowledgeBase
kb = KnowledgeBase(
name="my_knowledge",
embedding_model="paraphrase-multilingual-MiniLM-L12-v2"
)
# From text
kb.add(
content="Python is a high-level programming language...",
tags=["programming", "python"],
metadata={"source": "user", "date": "2026-03-22"}
)
# From document
kb.add_from_file("document.pdf", tags=["research"])
# From URL
kb.add_from_url("https://example.com/article", tags=["news"])
# Semantic search
results = kb.search(
query="What is machine learning?",
top_k=5
)
for r in results:
print(f"{r.score:.2f} | {r.content[:100]}...")
# Ask questions
answer = kb.ask(
question="What do I know about AI?",
include_sources=True
)
print(answer['answer'])
print("Sources:", answer['sources'])
# Get entity relationships
graph = kb.get_knowledge_graph()
# Find related concepts
related = kb.find_related("Python", depth=2)
| Method | Description |
|---|---|
add(content, ...) | Add single piece of knowledge |
add_batch(contents) | Add multiple items |
add_from_file(path) | Parse and add file |
add_from_url(url) | Fetch and add web content |
add_from_email(email) | Parse email content |
| Method | Description |
|---|---|
search(query, top_k) | Semantic search |
hybrid_search(query, ...) | Keyword + semantic |
filter_search(query, filters) | Search with filters |
find_similar(content) | Find similar items |
| Method | Description |
|---|---|
ask(question, ...) | Get answer with RAG |
get_context(question) | Get relevant context |
generate_summary(topic) | Generate topic summary |
| Method | Description |
|---|---|
get_knowledge_graph() | Get entity relationships |
list_tags() | List all tags |
export(format) | Export knowledge |
import_(data) | Import knowledge |
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Sources │────▶│ Ingestion │────▶│ Storage │
│ - Chat │ │ - Parser │ │ - Vector DB │
│ - Docs │ │ - Embedder │ │ - Graph DB │
│ - Web │ │ - Indexer │ │ - Document │
└─────────────┘ └─────────────┘ └─────────────┘
│
┌──────────────────────┘
▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Query │────▶│ Retrieve │────▶│ Generate │
│ - Search │ │ - Vector │ │ - LLM │
│ - Ask │ │ - Graph │ │ - Cite │
└─────────────┘ └─────────────┘ └─────────────┘
| Model | Dimensions | Languages | Use Case |
|---|---|---|---|
| paraphrase-multilingual-MiniLM-L12-v2 | 384 | 50+ | General |
| bge-small-zh-v1.5 | 512 | Chinese | Chinese |
| text-embedding-ada-002 | 1536 | EN | Production |
# Auto-capture from conversations
@hookimpl
def after_message(message, response):
kb.add(
content=f"User asked about: {extract_topics(message)}",
tags=["conversation", extract_topics(message)]
)
# Use knowledge in skills
def my_skill(query):
context = kb.search(query, top_k=3)
return generate_response(query, context)