Hub/Docs

Database

Turso cloud SQLite, schema, categories, edge types, and the relational model.

Schema

Schema Diagram

SQLite and the Relational Model

The wiki-base is a relational database. That means everything is stored in tables with rows and columns, and tables are connected to each other through foreign keys. If you know spreadsheets, think of each table as a sheet, but sheets can reference rows in other sheets.

We use SQLite, the most widely deployed database in the world. It's a single-file database engine, no separate server process. Turso hosts it in the cloud so the web app, bot, and MCP server all share one instance.

DetailValue
ProviderTurso (cloud-hosted libSQL, a SQLite fork)
Client@libsql/client
VectorNative F32_BLOB columns + vector_top_k()
Full-textFTS5 virtual tables with auto-sync triggers

Tables

nodes

The central table. Every piece of content, person, organization, and topic is a node.

ColumnTypeDescription
idINTEGER PKAuto-incrementing
titleTEXT NOT NULLNode title
descriptionTEXTOne-sentence summary
linkTEXTSource URL
node_typeTEXTCategory (see below)
event_dateTEXTISO 8601 date
chunkTEXTRaw source text
embeddingF32_BLOB(1536)Node-level vector
metadataJSONType-specific metadata
notesTEXTUser notes / analysis

chunks

Source text split into smaller pieces for search. See Indexing & Search for how chunking works.

ColumnTypeDescription
node_idINTEGER FKParent node
chunk_idxINTEGERPosition in sequence
textTEXT NOT NULL~2000 chars
embeddingF32_BLOB(1536)Vector embedding

edges

Directed relationships between nodes.

ColumnTypeDescription
from_node_idINTEGER FKSource node
to_node_idINTEGER FKTarget node
contextJSONType, confidence, explanation
sourceTEXTHow edge was created

dimensions

Tags/categories. Many-to-many with nodes via node_dimensions join table.

chats

Discord bot interaction traces. Full MCP tool call logs, timing, Discord context.

Categories

11 node types stored as node_type on the nodes table.

Categorynode_typeDescriptionSort
PodcastpodcastLatent Space episodes with full transcriptsRecent
Articlearticlelatent.space Substack postsRecent
AI NewsainewsDaily AINews digests from smol.aiRecent
Builders Clubbuilders-clubCommunity meetup recordingsRecent
Paper Clubpaper-clubDeep-dive paper discussionsRecent
WorkshopworkshopConference talks, tutorialsRecent
EventeventScheduled community events (paper club, builders club sessions)Recent
GuestguestPeople, guests, speakers, authorsMost connected
EntityentityOrganizations and technical topicsMost connected
HubhubInternal structural anchors (hidden)-
MembermemberDiscord community member profiles-

Edge Context Model

edges.context stores JSON with relationship semantics:

interface EdgeContext {
  type: EdgeContextType;       // Relationship type (see table below)
  confidence: number;          // 0–1
  explanation: string;         // Human-readable description
  created_via: string;         // 'ui' | 'agent' | 'mcp' | 'workflow'
  role?: string;               // e.g. host/guest for appeared_on
  depth?: string;              // mention / discussion / deep-dive
  valid_from?: string;         // Temporal bounds
  valid_until?: string;
}

Edge Types

14 relationship types stored in edges.context:

TypeDirectionExample
created_byContent → CreatorArticle → Author
featuresWhole → PartEpisode → Guest
appeared_onPerson → ContentGuest → Episode
covers_topicContent → TopicEpisode → "RAG"
affiliated_withPerson → OrgResearcher → OpenAI
expert_inPerson → TopicEngineer → "agents"
part_ofPart → WholeTalk → Conference
citesContent → SourceArticle → Paper
related_toAny ↔ AnyGeneral connection
interested_inMember → TopicUser → "agents"
extendsWork → PriorPaper → Earlier paper
supportsEvidence → ClaimStudy → Hypothesis
contradictsCounter → ClaimFinding → Earlier claim
source_ofDerivative → SourceSummary → Original

Metadata by Category

Stored in nodes.metadata as JSON. Each category has its own shape.

Podcast / Builders Club / Paper Club / Workshop:

{ "publish_date": "2025-01-15", "series": "latent-space-podcast", "duration": "1:23:45", "video_url": "https://..." }

Guest:

{ "role": "ML Engineer", "affiliations": ["OpenAI"], "expertise": ["agents", "RAG"], "twitter": "@handle" }

Entity:

{ "org_type": "startup", "website": "https://...", "founded": "2023", "hq": "San Francisco" }

Article:

{ "source_type": "blog", "authors": ["swyx"], "publish_date": "2025-02-01" }

AINews:

{ "source_type": "newsletter", "publish_date": "2025-02-01" }

Member:

{ "discord_id": "123456", "discord_handle": "user", "avatar_url": "...", "joined_at": "2025-01-01T00:00:00Z", "last_active": "...", "interaction_count": 5, "interests": ["agents", "RAG"] }

Example Queries

-- Count nodes by category
SELECT node_type, COUNT(*) as count
FROM nodes WHERE node_type IS NOT NULL
GROUP BY node_type ORDER BY count DESC;

-- Most connected guests
SELECT n.id, n.title, COUNT(e.id) as edge_count
FROM nodes n
JOIN edges e ON e.from_node_id = n.id OR e.to_node_id = n.id
WHERE n.node_type = 'guest'
GROUP BY n.id ORDER BY edge_count DESC LIMIT 20;

-- Recent podcast episodes
SELECT id, title, event_date, description
FROM nodes WHERE node_type = 'podcast'
ORDER BY event_date DESC LIMIT 10;

-- Edges for a specific node
SELECT e.id, e.context, src.title as from_title, tgt.title as to_title
FROM edges e
JOIN nodes src ON src.id = e.from_node_id
JOIN nodes tgt ON tgt.id = e.to_node_id
WHERE e.from_node_id = 42 OR e.to_node_id = 42;