| name | context |
| description | Ingest and structure knowledge from any source: PDFs, web pages, YouTube videos (with transcription), links, and notes. Everything is stored in OKF (Open Knowledge Format) with a mind graph of concepts and relations. TRIGGER when: user says 'guarda esto', 'remember this', 'ingest', 'extract concepts', 'build knowledge graph', 'add to my context', 'remember this PDF/link/video/note', or asks about knowledge management, OKF format, concept graphs, or mind maps. SKIP: user wants to search existing knowledge (use vector search), needs a database query, or is asking about RAG implementation details. |
Context — Knowledge Ingestion Skill
Ingest knowledge from any source into OKF (Open Knowledge Format), build a mind graph of concepts, and store it automatically.
How It Works
- Ingest: Fetch/extrac content from any source
- Analyze: Extract concepts and relations (using this Claude session)
- Store: Save to mind graph (automatically, no asking)
- Report: Show what was added
OKF Schema
interface OKFDocument {
id: string;
type: 'web' | 'pdf' | 'video' | 'note' | 'link';
title: string;
content: string;
url?: string;
metadata: {
created: string;
source: 'web' | 'pdf' | 'yt' | 'manual';
language?: string;
duration?: number;
authors?: string[];
tags: string[];
};
concepts: Array<{ id: string, label: string, importance: number, mentions: number }>;
relations: Array<{ from: string, to: string, type: string, weight: number }>;
}
Mind Graph
Stored at ~/.divagator/graph.json. Auto-persisted on every ingest.
mkdir -p ~/.divagator
touch ~/.divagator/graph.json
Format:
{
"nodes": [
{ "id": "concept_1", "label": "CachedNetworkImage", "importance": 0.9, "mentions": 8, "sources": ["okf_123_abc"] }
],
"edges": [
{ "from": "concept_1", "to": "concept_2", "type": "extends", "weight": 0.8, "sources": ["okf_123_abc"] }
]
}
How to Execute (Automatic Flow)
Step 1: Identify Source Type
Web URL: https://...
PDF file: /path/to/file.pdf
YouTube: https://youtube.com/... or yt:...
Note: Any raw text (no URL prefix)
Step 2: Ingest Content
Web Page:
curl -s -L -A "Mozilla/5.0" "<URL>" | \
sed 's/<script[^>]*>.*<\/script>//g' | \
sed 's/<style[^>]*>.*<\/style>//g' | \
sed 's/<[^>]*>/ /g' | \
tr -s ' \n' ' ' | \
cut -c1-15000
PDF:
pdftotext /path/to/file.pdf - 2>/dev/null | cut -c1-15000
YouTube Video:
mkdir -p /tmp/divagator-yt
yt-dlp -x --audio-format mp3 \
-o "/tmp/divagator-yt/%(id)s.%(ext)s" \
"<YOUTUBE_URL>"
VIDEO_ID=$(yt-dlp --get-id "<YOUTUBE_URL>")
AUDIO_FILE="/tmp/divagator-yt/${VIDEO_ID}.mp3"
python3 -c "
from lightning_whisper_mlx import LightningWhisperMLX
model = LightningWhisperMLX(model='small', batch_size=16)
result = model.transcribe('$AUDIO_FILE')
print(result['text'])
"
Note: User provided text directly.
Step 3: Extract Title
- Web/PDF: Extract from content or filename
- YouTube: Use video title from yt-dlp
- Note: User provided or generate from first line
Step 4: Extract Concepts (Claude Analysis)
Analyze the content within this conversation to extract:
- Concepts: Named entities, key terms, important phrases
- Importance: 0.0-1.0 based on mention frequency and centrality
- Relations: Connect concepts, assign type (
relates, extends, contradicts, unknown)
- Weight: 0.0-1.0 based on connection strength
Step 5: Build OKFDocument
{
"id": "okf_<timestamp>_<random>",
"type": "video|web|pdf|note|link",
"title": "<title>",
"content": "<content>",
"url": "<url if applicable>",
"metadata": {
"created": "<ISO timestamp>",
"source": "yt|web|pdf|manual",
"tags": []
},
"concepts": [...],
"relations": [...]
}
Step 6: Update Mind Graph (Automatic)
- Load existing graph from
~/.divagator/graph.json
- Add new concepts (merge if concept label already exists, update importance/mentions)
- Add new relations (merge if relation already exists, update weight)
- Save back to
~/.divagator/graph.json
Step 7: Report
✓ Added to context:
**Source**: [title](url)
**Type**: web/pdf/video/note
**Concepts**: 9 extracted
**Relations**: 4 new connections
**Mind Graph**: 24 concepts, 31 relations now in ~/.divagator/graph.json
Invocation Examples
/context ingest https://example.com/article
/context add this PDF: /path/to/paper.pdf
/context remember this YouTube: https://youtube.com/watch?v=...
/context add a note: "La memoria se consolida durante el sueño REM"
Query Commands
/context graph — show full mind graph summary
/context concepts about <topic> — find concepts related to topic
/context stats — show graph statistics
Environment
| Variable | Default | Description |
|---|
YT_OUTPUT | /tmp/divagator-yt | YouTube audio temp |
Notes
- No API key needed: Concept extraction uses this Claude conversation
- Auto-persist: Graph saved to
~/.divagator/graph.json after every ingest
- Merge behavior: Existing concepts are merged by label (highest importance wins)
- YouTube: Requires
yt-dlp and lightning-whisper-mlx (pip install lightning-whisper-mlx)