Skip to main content
Membrane is configured via a YAML file, command-line flags, and environment variables. Flags override file values; environment variables are read for secrets not set in the config.

YAML config file

Full example with all available fields:
backend: "sqlite"
db_path: "membrane.db"
# postgres_dsn: "postgres://membrane:membrane@localhost:5432/membrane?sslmode=disable"
listen_addr: ":9090"
decay_interval: "1h"
consolidation_interval: "6h"
default_sensitivity: "low"
selection_confidence_threshold: 0.7

# Optional embedding-backed retrieval (Postgres only)
# embedding_endpoint: "https://api.openai.com/v1/embeddings"
# embedding_model: "text-embedding-3-small"
# embedding_dimensions: 1536
# embedding_api_key: ""   # or set MEMBRANE_EMBEDDING_API_KEY

# Optional LLM-backed semantic extraction (Postgres only)
# llm_endpoint: "https://api.openai.com/v1/chat/completions"
# llm_model: "gpt-5-mini"
# llm_api_key: ""         # or set MEMBRANE_LLM_API_KEY

# Security (prefer environment variables for keys)
# encryption_key: ""       # or set MEMBRANE_ENCRYPTION_KEY
# api_key: ""              # or set MEMBRANE_API_KEY
# tls_cert_file: ""
# tls_key_file: ""
rate_limit_per_second: 100
Load the file from Go:
cfg, err := membrane.LoadConfig("/etc/membrane/config.yaml")
if err != nil {
    log.Fatal(err)
}
LoadConfig starts from DefaultConfig() and unmarshals the YAML on top, so fields not present in the file retain their defaults.

DefaultConfig() defaults

Calling membrane.DefaultConfig() produces:
FieldDefault value
Backend"sqlite"
DBPath"membrane.db"
ListenAddr":9090"
DecayInterval1h
ConsolidationInterval6h
DefaultSensitivity"low"
SelectionConfidenceThreshold0.7
EncryptionKey"" (unencrypted)
EmbeddingDimensions1536
RateLimitPerSecond100

Config struct fields

Storage

backend
string
Storage backend. Options: "sqlite" (default) or "postgres".
db_path
string
SQLite database file path. Default: "membrane.db". Ignored when backend is "postgres".
postgres_dsn
string
PostgreSQL connection string. Required when backend is "postgres". Falls back to the MEMBRANE_POSTGRES_DSN environment variable if not set in config.Example: postgres://membrane:membrane@localhost:5432/membrane?sslmode=disable

Network

listen_addr
string
gRPC server listen address. Default: ":9090".

Scheduling

decay_interval
duration
How often the decay scheduler runs. Default: "1h". Accepts Go duration strings ("30m", "2h", etc.).
consolidation_interval
duration
How often the consolidation scheduler runs. Default: "6h". Consolidation extracts semantic facts and competence records from episodic traces.

Ingestion

default_sensitivity
string
Default sensitivity level assigned to records at ingestion when not explicitly overridden. Default: "low".Valid values: public, low, medium, high, hyper.

Retrieval

selection_confidence_threshold
float64
Minimum confidence for competence and plan_graph candidates to pass the selector. Default: 0.7.

Embedding

embedding_endpoint
string
HTTP endpoint for generating record and query embeddings. Requires backend: postgres and embedding_model. Example: https://api.openai.com/v1/embeddings.
embedding_model
string
Embedding model name sent to the embedding endpoint. Example: text-embedding-3-small.
embedding_dimensions
int
Output dimension of the embedding model. Default: 1536. Must match the model’s actual output dimensions.
embedding_api_key
string
API key for the embedding endpoint. Prefer setting MEMBRANE_EMBEDDING_API_KEY instead.

LLM

llm_endpoint
string
HTTP endpoint for the LLM used in semantic extraction during consolidation. Requires backend: postgres. Example: https://api.openai.com/v1/chat/completions.
llm_model
string
Chat model name sent to the LLM endpoint. Example: gpt-5-mini.
llm_api_key
string
API key for the LLM endpoint. Prefer setting MEMBRANE_LLM_API_KEY instead.

Security

encryption_key
string
SQLCipher PRAGMA key value for encrypting the SQLite database at rest. Falls back to MEMBRANE_ENCRYPTION_KEY. When empty, the database is unencrypted.
tls_cert_file
string
Path to TLS certificate PEM file. TLS is disabled when empty.
tls_key_file
string
Path to TLS private key PEM file. Required when tls_cert_file is set.
api_key
string
Shared secret for gRPC client authentication via bearer token. Falls back to MEMBRANE_API_KEY. Authentication is disabled when empty.
rate_limit_per_second
int
Maximum gRPC requests per second per client. 0 disables rate limiting. Default: 100.

Environment variables

VariableConfig fieldDescription
MEMBRANE_ENCRYPTION_KEYencryption_keySQLCipher encryption key for the SQLite database
MEMBRANE_POSTGRES_DSNpostgres_dsnPostgreSQL DSN, read when backend: postgres
MEMBRANE_EMBEDDING_API_KEYembedding_api_keyAPI key for the embedding endpoint
MEMBRANE_LLM_API_KEYllm_api_keyAPI key for the LLM semantic extraction endpoint
MEMBRANE_API_KEYapi_keyBearer token for gRPC client authentication

Command-line flags

Flags override values set in the config file.
FlagOverridesDescription
--config <path>Load YAML config file from <path>
--db <path>db_pathSQLite database path
--postgres-dsn <dsn>postgres_dsn + backendPostgreSQL DSN; also sets backend = "postgres"
--addr <addr>listen_addrgRPC listen address
--versionPrint version and exit

Build docs developers (and LLMs) love