/brain — Knowledge Graph Engine
Search, analyze, and manage knowledge brains powered by genie-brain. Brains are Postgres-backed, Obsidian-compatible knowledge vaults with BM25 + vector search, confidence scoring, and agentic autoschema.When to Use
- Search for knowledge before answering a domain question
- Check what the brain knows (and doesn’t know) about a topic
- Analyze content with deep reasoning via rlmx
- Ingest new content into the brain
- Check brain health and coverage gaps
- Mount external directories as brain sources
- Manage brain access (attach agents, tasks, teams)
- Audit query history and search strategy
Prerequisites
Brain must be installed before use:Lifecycle Commands
genie brain init
Scaffold a new brain vault with Obsidian-compatible directory structure, templates, and Postgres registration.
genie brain create
Register a brain in Postgres without creating a filesystem vault. For runtime brains that don’t need a directory.
genie brain archive
Mark a brain as archived. Still searchable, no longer accepts updates.
genie brain migrate
Run database migrations for brain tables. Idempotent — safe to re-run.
Ingest Commands
genie brain upgrade
Sync filesystem content to Postgres. Walks the brain directory and mounts, chunks text, computes embeddings, and upserts to Postgres. Hash-based skip for unchanged files.
genie brain process
Handle multimodal files in the to_process/ directory. Supports audio (Whisper transcription), video (frame extraction + transcript), PDF (page-level OCR), images (vision API), code (symbol extraction), and Markdown (classification).
genie brain watch
Auto-index files when they appear in the to_process/ directory.
genie brain mount
Attach an external directory to a brain. Creates a symlink in _mounts/ so the content is included in update scans and visible in Obsidian.
genie brain unmount
Remove an external directory mount.
Query Commands
genie brain search
Find knowledge with confidence scoring. Returns ranked results with confidence level.
genie brain get
Retrieve a specific document by file path or document ID.
genie brain analyze
Deep reasoning via rlmx. Generates synthesized answers (not snippets) with sources and cost.
Knowledge Commands
genie brain link
Discover connections between documents. Generates 10 link types: tag-overlap, semantic, wikilink, caused, superseded, contradicts, supports, updates, extends, derives.
genie brain health
Lint brain and compute a 7-dimension health score (each out of 100): Frontmatter, Structure, Links, Currency, Coverage, Consistency, Orphans.
--fix to auto-repair: adds missing dates, converts tags, generates MOCs.
genie brain status
Brain dashboard — lists all registered brains with file counts, chunk counts, mounts, health, query stats, and last update time.
Identity Commands (RBAC)
genie brain attach
Grant an entity access to a brain. Role hierarchy: owner (full control) > writer (update + search) > reader (search only).
agent:genie, task:123, team:platform.
genie brain detach
Revoke entity access from a brain.
genie brain list
Show all brain-entity attachments.
Observability Commands
genie brain traces
Query search history with confidence, latency, cost, and gap detection.
genie brain strategy
Per-brain search strategy routing. Route queries matching a glob pattern to a specific strategy.
genie brain cache
Estimate CAG cache costs — shows token counts, per-query cost, and break-even query count.
Search Strategies
RAG (default)
Retrieval-Augmented Generation. Combines three search backends via Reciprocal Rank Fusion (RRF):- BM25 — full-text search on documents and chunks
- Trigram — fuzzy matching via PostgreSQL pg_trgm
- Vector — semantic search via embeddings (Gemini E2)
CAG
Context-Augmented Generation. Finds top 5 relevant docs via RAG, loads entire documents as LLM context, then runs rlmx with prompt caching for synthesis. Best for: synthesized answers, complex reasoning, cross-document analysis. Higher per-query cost but cached after first run (90% savings on repeats). Use--strategy cag to force CAG, or configure per-brain routing with genie brain strategy set.
Confidence Scoring
Gap detection automatically flags LOW/NONE results and suggests action:
use_brain, supplement, go_external, research_needed.
Brain Types
Agent Usage Patterns
Before answering domain questions
genie brain search "<topic>" --brain <id>- Check confidence level
- FULL/HIGH — cite the results
- PARTIAL — use results + note limitations
- LOW/NONE — say “brain doesn’t cover this” and research externally
After learning something new
- Write a
.mdfile with YAML frontmatter tobrain/to_process/ genie brain process --brain <id>to classify and indexgenie brain upgrade --brain <id>to sync to Postgres
Sharing brains across agents
genie brain attach <brain-id> --entity agent:other --role reader- The other agent can now search the brain
- Use
writerrole if the other agent should also contribute content