membraned) that exposes the full gRPC API. This guide covers building the binary, command-line flags, Docker Compose, and deployment tier selection.
Building the binary
./bin/membraned. Verify the build:
Starting the daemon
Default SQLite storage
Zero-configuration start. Membrane creates
membrane.db in the working directory.Command-line flags
| Flag | Type | Default | Description |
|---|---|---|---|
--config | string | "" | Path to YAML config file |
--db | string | "membrane.db" | SQLite database path (overrides config) |
--postgres-dsn | string | "" | PostgreSQL DSN; also switches backend to postgres |
--addr | string | ":9090" | gRPC listen address (overrides config) |
--version | bool | false | Print version and exit |
--postgres-dsn implicitly sets Backend = "postgres". You do not need to also set backend: postgres in the config file when using this flag.Docker Compose setup
The repository includes adocker-compose.yml for running the Postgres + pgvector backend:
Postgres setup
Membrane requires PostgreSQL 14+ with thepgvector extension. The pgvector/pgvector:pg16 Docker image includes it pre-installed.
If you are using an existing Postgres instance, install the extension:
Environment variable reference
| Variable | Purpose |
|---|---|
MEMBRANE_ENCRYPTION_KEY | SQLCipher encryption key for the SQLite database |
MEMBRANE_POSTGRES_DSN | PostgreSQL DSN, used when backend: postgres |
MEMBRANE_EMBEDDING_API_KEY | API key for the embedding endpoint |
MEMBRANE_LLM_API_KEY | API key for the semantic extraction LLM endpoint |
MEMBRANE_API_KEY | Bearer token for gRPC client authentication |
MEMBRANE_API_KEY is read only from the environment when api_key is empty in the config.
Starting with a custom config file
Create a config file and pass it with--config:
Deployment tiers
Choose a tier based on your concurrency and feature requirements:| Tier | Backend | Embedding | LLM | When to use |
|---|---|---|---|---|
| 1 | SQLite | — | — | Single-process agents, development, zero-infra deployments |
| 2 | Postgres | — | — | Multiple concurrent writers, production with existing Postgres |
| 3 | Postgres + pgvector | Yes | — | Semantic similarity ranking for competence and plan_graph retrieval |
| 4 | Postgres + pgvector | Yes | Yes | Full system: background LLM extraction turns episodic traces into semantic facts |
Tier 1 — SQLite
Default. Zero dependencies, embedded store, confidence-based applicability fallback. Ideal for single-agent workloads.
Tier 2 — Postgres
Concurrent writers, JSONB storage, same retrieval semantics as tier 1. Use when multiple agents or processes share one substrate.
Tier 3 — pgvector
Adds embedding similarity scoring for competence and plan_graph selection. Retrieval quality improves with more ingested records.
Tier 4 — Full
Adds LLM-backed consolidation that automatically extracts typed semantic facts from episodic traces during background consolidation runs.
Graceful shutdown
The daemon handlesSIGINT and SIGTERM. On receipt, it:
- Cancels the background context to stop decay and consolidation schedulers.
- Drains in-flight gRPC requests.
- Closes the database.
SIGKILL during an active consolidation run.