⬡MEDIABRAIN· MULTIMODAL MEMORY EXPLORER
API …MEDIA 0ENCODER …STORE pgvector
SNAPSHOT
⬡ SOVEREIGN STACK · BRAIN FLEET · LIVE INSTRUMENT

MEDIABRAIN

The deep memory engine for media — video, audio, images in one shared 1024-dimension embedding space. LanguageBind encodes all three towers through a common OpenCLIP backbone, so a single audio query ranks image and video hits alongside audio. Stored on PostgreSQL + pgvector, same stack as SoulBrain and CodeBrain. No Qdrant — own your stack.

MEDIA INGESTED
0
live count · media_embeddings
HTTP API :17333
…
axum · CORS ✓
ENCODER :8500
…
LanguageBind service
VECTOR STORE
1024-dim
pgvector · HNSW · cosine
BAKED PROBE (2026-09-16 02:0x CDT) · GET /health → {"service":"mediabrain","status":"ok"} · GET /api/stats → {"status":"success","total_media":0} · listener 127.0.0.1:17333 pid 2502 · encoder :8500 offline · inbox /data/media_inbox not yet created

⬡MODALITY MEMORY PIPELINE

hover nodes to identify — INGEST FLOW runs the real mechanism: walkdir → modality gate → LanguageBind 1024-dim encode → pgvector
IMAGE LANE VIDEO LANE AUDIO LANE SKIP (unrecognized ext) QUERY RETURN (encode_text → cosine ⇔)

⬡LIVE QUERY CONSOLE

TEXT-PATH FALLBACK MODE
POST /api/query {query, limit} — vector search arms when the LanguageBind encoder (:8500) is up; MCP tool search_media(query, limit) walks the same store

⬡MODALITY MATRIX — REAL EXTENSION MAP

MODALITYRECOGNIZED EXTENSIONS (source: modality.rs)VECTOR LANE
IMAGEjpgjpegpngwebpbmptiffheicimage tower → shared space
VIDEOmp4movmkvaviwebmm4vvideo tower → shared space
AUDIOmp3wavflacoggm4aaacaudio tower → shared space
UNRECOGNIZEDskipped, never guessed — extension sniffing is safe because ingestion is a controlled inbox on this box, not arbitrary uploads
WHY ONE TABLE: all three modalities share one 1024-dim OpenCLIP-derived space in media_embeddings(id, source_path, modality, embedding, ingested_at) — that is what makes one audio query return image and video hits ranked alongside each other. HNSW cosine index. Upsert checks dim 1024 hard: a mismatched checkpoint fails loudly at startup instead of silently corrupting the table.

⬡MODULE MAP — 865 LOC / 7 MODULES

⬡API SURFACE + ENVIRONMENT

GET /health → {"service":"mediabrain","status":"ok"} — liveness
GET /api/stats → {"status":"success","total_media":N} — COUNT(*) on media_embeddings
POST /api/query {query, limit≤100} — ILIKE on source_path; text fallback while the encoder is offline; errors return {"status":"error"} honestly
GET /api/get/:id → {media_type, name, path, metadata.ingested_at} — LIKE source_path lookup
MCP search_media(query, limit) — stdio `media_brain serve` · vector path: encode_text → cosine distance ⇔ → ranked hits
ENV (all knobs, one binary): LANGUAGEBIND_URL=http://127.0.0.1:8500 · DATABASE_URL=postgresql://soulbrain@localhost/mediabrain · MEDIA_BRAIN_INBOX=/data/media_inbox · MEDIA_BRAIN_MAX_CONCURRENT=1 · binary: media_brain v0.2.0 (Cargo) · modes: ingest / serve (MCP) / http :17333

⬡INGESTION LAW — FROM THE SOURCE

Ⅰ

P4 LAW: CONCURRENCY 1

8GB VRAM, no tensor cores, three LanguageBind towers loaded at once on an OpenCLIP backbone. A semaphore bounds the pipeline to one in-flight encode — raise it only after watching nvidia-smi during a real batch, never blind.

Ⅱ

PATH, NOT BYTES

Rust and the Python encoder share the R630 filesystem. Loopback calls send file paths, not serialized video — zero pointless copy cost for 4GB files.

Ⅲ

ONE CORRUPT FILE CANNOT KILL THE BATCH

Per-file errors are logged and skipped; the overnight job ends with a summary — succeeded / skipped / failed. walkdir keeps walking.

Ⅳ

120s ENCODE PATIENCE

Video/audio encodes are slow on this hardware by nature. The client waits two minutes per file rather than timing out a healthy-but-busy request.

Ⅴ

DIM CHECK AT THE DOOR

EMBEDDING_DIM=1024 is hardcoded. Any checkpoint swap that changes dimensionality fails loudly at startup — the table is never silently corrupted.

Ⅵ

OWN YOUR STACK

PostgreSQL + pgvector, the same stack as SoulBrain and CodeBrain. No external vector-store dependency. Qdrant-free by directive.

⬡BRAIN FLEET — LIVE LISTENERS

⬡ KNOWLEDGESOULBRAIN:17331
⬡ CODECODEBRAIN:17332
⬡ MEDIAMEDIABRAIN:17333
⬡ SENSESSOVEREIGN-SENSE:17340