Skip to content

Reference

Configuration

Environment variables, the brain.db config table, and the ~/.gbrain/ filesystem layout.

GigaBrain reads configuration from three places, in order of precedence: command-line flags, environment variables, and the config table inside brain.db. Anything that requires a fresh model or a new database (most notably the embedding model) is also recorded in the immutable brain_config table at init time.

User-facing variables. Internal/test-only flags are intentionally omitted.

VariableUsed byDefaultNotes
GBRAIN_DBevery command./brain.dbPath to the brain database file.
GBRAIN_MODELevery commandsmallEmbedding model alias (small/base/large/m3) or any Hugging Face model ID. On the airgapped build, non-default values produce a warning and are ignored.
GBRAIN_CHANNELinstall scriptairgappedSelects which release channel the shell installer downloads. Set to online for the smaller binary that pulls model assets at first use.
GBRAIN_WATCH_DEBOUNCE_MSwatcher / vault sync1500Debounce window before the file watcher flushes a batch of changes. Higher values reduce churn during noisy edits.
GBRAIN_QUARANTINE_TTL_DAYSquarantine GC30Auto-discard threshold for clean quarantined pages with no remaining DB-only state.
GBRAIN_RAW_IMPORTS_KEEPraw-import GC10Per-page cap on retained raw_imports history rows.
GBRAIN_RAW_IMPORTS_TTL_DAYSraw-import GC90Time-to-live for inactive raw_imports rows.
GBRAIN_RAW_IMPORTS_KEEP_ALLraw-import GCunsetSet to 1 to disable raw-import GC entirely.
GBRAIN_FULL_HASH_AUDIT_DAYScollection audit7Interval after which the full-hash audit pass re-hashes a file.
GBRAIN_HF_BASE_URLonline-model fetchhttps://huggingface.coOverride the Hugging Face origin (e.g. for an internal mirror).
GBRAIN_MODEL_CACHE_DIRonline-model fetch~/.gbrain/models/Cache directory for downloaded model weights.

The --db and --model CLI flags are global and override the corresponding env vars on a per-invocation basis.

GigaBrain owns one directory under your home folder:

~/.gbrain/
├── skills/ # Embedded skills extracted on first run
│ ├── ingest/SKILL.md
│ ├── query/SKILL.md
│ └── …
└── models/ # Cached model weights (online build only)
└── BAAI__bge-base-en-v1.5/

Custom skills resolve in this order: working-directory SKILL.md~/.gbrain/skills/<name>/SKILL.md → embedded default. Run gbrain skills doctor to see what is shadowing what.

The brain itself lives wherever you tell it to — typical defaults are ./brain.db for project-scoped brains and ~/brain.db for a personal brain. SQLite WAL sidecars (brain.db-wal, brain.db-shm) are created at runtime and folded back in by gbrain compact.

The config table inside brain.db holds runtime defaults editable via gbrain config:

Terminal window
gbrain config get default_token_budget
gbrain config set default_token_budget 6000
gbrain config reset default_token_budget

Recognized keys (with seeded defaults):

KeyDefaultEffect
version5Schema version. Don’t edit by hand.
embedding_modelBAAI/bge-small-en-v1.5Mirror of the active model from brain_config. Read-only; managed by init.
embedding_dimensions384Mirror of the active model’s vector width.
chunk_strategysectionHow pages are split before embedding.
search_merge_strategyset-unionHow FTS5 and vector results are fused.
default_token_budget4000Used by query --depth auto.

brain_config holds metadata that cannot change after init without rebuilding the database:

KeyExampleNotes
model_idBAAI/bge-small-en-v1.5Full Hugging Face model ID.
model_aliassmallThe alias passed to init.
embedding_dim384Vector width. Determines which page_embeddings_vec_* table is used.
schema_version5Validated on every open.

On open, gbrain verifies the requested model matches the recorded one. A mismatch errors out before any command runs. To switch models, initialize a new brain and import into it.

FeatureEffect
embedded-model (default)Airgapped build. Embeds BGE-small (~180 MB) directly into the binary. Non-default model selection is a warning-only no-op.
online-modelSmaller binary (~90 MB). Downloads and caches the selected model on first semantic use.
Terminal window
# Default (airgapped)
cargo build --release
# Online build
cargo build --release --no-default-features --features bundled,online-model

See Airgapped vs online for guidance on which channel to use, and Embedding models for the design.