A guide for setting up a private semantic knowledge base with automated maintenance
This document describes how to build a personal knowledge graph using Wikibase, integrated with OpenClaw for AI-assisted curation. The system enables "write-ahead linking" where you casually reference topics in your notes/tasks, and automation handles entity creation, research, and quality assurance.
Target Audience: Another OpenClaw instance or technical user wanting to replicate this setup.
| Component | Purpose | Self-Hosted? |
|---|---|---|
| Wikibase | Structured knowledge storage with SPARQL queries | Yes (Docker/K8s) |
| Fizzy | Task management with cards and comments | Yes (Rails app) |
| OpenClaw | AI assistant for automation and curation | Yes |
| Obsidian | Long-form notes and documentation | Local app |
User writes [[wb:Topic]] in Fizzy card
↓
Cron job scans for placeholders (every 6h)
↓
Search Wikibase for existing entity
↓
If not found: Create stub + research card
↓
Enrichment job adds properties (every 8h)
↓
Review job checks quality (daily)
↓
Rich, queryable knowledge graph
Use the official Wikibase Docker Suite or deploy to Kubernetes:
# Example K8s deployment (simplified)
apiVersion: apps/v1
kind: Deployment
metadata:
name: wikibase
spec:
containers:
- name: wikibase
image: wikibase/wikibase:latest
env:
- name: MW_ADMIN_PASS
valueFrom:
secretKeyRef:
name: wikibase-secrets
key: admin-passwordKey Configuration:
- Enable the Wikibase API
- Set up admin credentials (store in 1Password or similar)
- Configure SPARQL endpoint for queries
Define foundational types and properties:
Type Items (Classes):
| QID | Label | Description |
|---|---|---|
| Q1 | Person | Human being |
| Q2 | Company | Business organization |
| Q3 | Project | Work project or initiative |
| Q4 | Place | Geographic location |
| Q5 | Event | Occurrence in time |
| Q6 | Concept | Abstract idea or category |
Core Properties:
| PID | Label | Type | Description |
|---|---|---|---|
| P1 | instance of | Item | Type/class of entity |
| P2 | date of birth | Time | Birth date |
| P6 | start date | Time | When something began |
| P20 | website | URL | Web presence |
| P24 | creator | Item | Who made this |
| P25 | uses technology | Item | Tech stack |
Script: wikibase-link-reconcile.sh
This script scans your task system for [[wb:Entity Name]] patterns and creates Wikibase entities.
#!/usr/bin/env bash
# Core logic (simplified)
# 1. Authenticate with Wikibase
wikibase_login
# 2. Get all cards/notes with [[wb:...]] patterns
patterns=$(grep -oP '\[\[wb:[^\]]+\]\]' "$content")
# 3. For each pattern:
for pattern in $patterns; do
entity_name="${pattern//\[\[wb:/}"
entity_name="${entity_name//\]\]/}"
# Search Wikibase
qid=$(search_wikibase "$entity_name")
if [[ -z "$qid" ]]; then
# Create stub
qid=$(create_stub_entity "$entity_name")
# Create research card for enrichment
create_research_card "$entity_name" "$qid"
fi
# Replace placeholder with real URL
replace_placeholder "$pattern" "$WIKIBASE_URL/wiki/Item:$qid"
doneCron Schedule: Every 6 hours
OpenClaw Cron Job:
{
"name": "Wikibase Link Reconciliation",
"schedule": {"kind": "every", "everyMs": 21600000},
"payload": {
"kind": "systemEvent",
"text": "Run wikibase link reconciliation: /path/to/script.sh"
},
"sessionTarget": "main"
}Script: wikibase-enrich-entities.sh
Finds stub entities and triggers AI research to enrich them.
# Core logic (simplified)
# 1. Query recently created/modified entities
entities=$(get_recent_entities)
# 2. Check if each is a stub
for qid in $entities; do
if is_stub "$qid"; then
echo "$qid|$label" >> /tmp/stubs_to_enrich.txt
fi
done
# 3. Output list for AI session to processOpenClaw Cron Job (Isolated Session):
{
"name": "Wikibase Entity Enrichment",
"schedule": {"kind": "every", "everyMs": 28800000},
"payload": {
"kind": "agentTurn",
"message": "Execute enrichment script, then for each stub in /tmp/stubs_to_enrich.txt: research the topic via web search and add Wikibase properties."
},
"sessionTarget": "isolated"
}Script: wikibase-weekly-review.sh
Daily QA pass on entities from the last 7 days.
Quality Checks:
- Has label and description
- Description > 20 characters
- Has instance_of (P1) claim
- Has at least 2 claims total
Output: Markdown report in Obsidian
Cron Schedule: Daily at 2am local time
When writing in Fizzy (or any integrated system), use the placeholder syntax:
Working on integrating [[wb:Home Assistant]] with [[wb:OpenClaw]].
The setup runs on [[wb:Proxmox VE]] using [[wb:Kubernetes]].Within 6 hours, each becomes a real link. If the entity doesn't exist, a stub is created and a research card queued.
Skip patterns that look like documentation examples:
# In extract_wb_links function
clean_text=$(echo "$text" | sed 's/`[^`]*`//g') # Remove code blocks
patterns=$(echo "$clean_text" | grep -v -E '\[\[wb:(Entity Name|\.\.\.)\]\]')An entity is considered a stub if:
- Description < 50 characters, OR
- Fewer than 2 claims, OR
- Missing instance_of (P1)
Execute /path/to/wikibase-enrich-entities.sh to scan for stubs.
For each stub in /tmp/wikibase_pending_enrichment.txt:
1. Read the current label and description
2. Search the web for authoritative information
3. Add relevant Wikibase properties:
- P1 (instance of) - classify the entity type
- Relevant relationships based on entity type
4. Write a comprehensive description (2-3 sentences)
5. Update the entity via Wikibase API
Run /path/to/wikibase-weekly-review.sh
Review the generated report at /path/to/reports/wikibase-review/YYYY-MM-DD.md
For entities with critical issues:
- Create Fizzy cards for items needing human judgment
- Auto-fix issues where confident (e.g., add missing P1 for obvious types)
Sync Wikibase claims to Obsidian frontmatter:
---
wikibase: Q35
instance_of: knowledge graph
creator: Nathan Broadbent
start_date: 2026-01
---Expose SPARQL via natural language:
- "Who do I know in Auckland?" → Query persons with residence = Auckland
- "What projects use Kubernetes?" → Query items with uses_technology = Kubernetes
| File | Purpose |
|---|---|
/scripts/wikibase-link-reconcile.sh |
Link reconciliation script |
/scripts/wikibase-enrich-entities.sh |
Enrichment scanner |
/scripts/wikibase-weekly-review.sh |
QA review script |
/obsidian/Knowledge Base/Schema.md |
Property and type definitions |
/obsidian/Knowledge Base/Current State.md |
Status overview |
/obsidian/reports/wikibase-review/ |
Daily QA reports |
- Wikibase uses MediaWiki login API
- Store credentials in 1Password:
op://vault/wikibase/admin_password - Cookie file:
/tmp/wb_cookies.txt
- Check CSRF token is valid (refresh after login)
- Ensure JSON is properly escaped
- Verify API permissions for WikibaseAdmin user
- Check lookback window (default 24h for enrichment)
- Verify recentchanges API is returning data
- Namespace 120 = Item namespace in Wikibase
- Entity count grows steadily over time
- Stub ratio decreases (more entities fully enriched)
- Weekly review pass rate improves
- Link placeholders get resolved within 6 hours
This PRD enables any OpenClaw instance to replicate the Broadbent Knowledge Graph setup. Adapt paths, credentials, and schedules to your environment.