Skip to main content

/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:
If not installed, the skill will guide you to run the install command.

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

Find knowledge with confidence scoring. Returns ranked results with confidence level.
Always search before answering domain questions. If confidence is LOW or NONE, say so — don’t hallucinate.

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

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.
Use --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).
Entity format: 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):
  1. BM25 — full-text search on documents and chunks
  2. Trigram — fuzzy matching via PostgreSQL pg_trgm
  3. Vector — semantic search via embeddings (Gemini E2)
Best for: factual lookups, specific topics, quick answers.

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

  1. genie brain search "<topic>" --brain <id>
  2. Check confidence level
  3. FULL/HIGH — cite the results
  4. PARTIAL — use results + note limitations
  5. LOW/NONE — say “brain doesn’t cover this” and research externally

After learning something new

  1. Write a .md file with YAML frontmatter to brain/to_process/
  2. genie brain process --brain <id> to classify and index
  3. genie brain upgrade --brain <id> to sync to Postgres

Sharing brains across agents

  1. genie brain attach <brain-id> --entity agent:other --role reader
  2. The other agent can now search the brain
  3. Use writer role if the other agent should also contribute content