Configuration
Startup environment variables configure connections, providers, listeners, and hard bounds. PostgreSQL-backed runtime settings configure supported operator policy. This page owns setting names and defaults; procedures belong to Operations Runbook.
Sources And Precedence
%%{init: {"flowchart": {"curve": "linear"}}}%%
flowchart LR
Environment["Deployment environment"] --> Startup["Validated startup configuration<br/>Restart to change"]
Database[("PostgreSQL app_config")] --> Runtime["Validated runtime snapshot"]
Control["Private control settings"] --> Database
Startup --> Effective["Effective operation configuration"]
Runtime --> EffectiveCompose forwards a selected set of environment variables. Use a deployment override for additional startup variables. Runtime keys are not automatically environment overrides. Examples can explicitly choose values different from application defaults.
Required Startup Settings
| Setting | Requirement |
|---|---|
POSTGRES_DSN or PostgreSQL components | Writable single-primary database. |
AI_API_URL, AI_API_KEY | Embedding endpoint and credential. |
AI_API_EMBEDDING_MODEL, AI_API_EMBEDDING_DIMENSIONS | Explicit model and positive compatible dimensions. |
AI_VERIFIER_MODEL | Explicit assessment model. |
CONTROL_PORTAL_TOKEN | Control access in the bundled setup. |
Use the environment example from the same release as your image. The
application source example at revision f786f023 shows the updated settings. Keep credentials private.
Listeners
| Variable | Default | Meaning |
|---|---|---|
HTTP_ADDR | :8080 | Main listener. |
CONTROL_HTTP_ADDR | :8090 | Separate control listener. |
DENSE_MEM_PORT | 8080 in Compose | Published main port. |
CONTROL_PORTAL_BIND | 127.0.0.1 in expert Compose | Published control address; base Compose fixes loopback. |
CONTROL_PORTAL_PORT | 8090 in Compose | Published control port. |
PostgreSQL And pgvector
| Variable | Application default | Meaning |
|---|---|---|
POSTGRES_DSN | Empty | Full DSN; otherwise construct from components. |
POSTGRES_HOST, POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB | Required for component configuration | Connection components. |
POSTGRES_PORT | 5432 | Database connection port. Expert Compose uses it as the PostgreSQL host port on loopback. |
POSTGRES_SSLMODE | disable | Driver TLS mode; configure for deployment. |
POSTGRES_MAX_OPEN_CONNS | 25 | Per-process pool bound. |
POSTGRES_MAX_IDLE_CONNS | 10 | Idle pool target. |
POSTGRES_CONN_MAX_LIFETIME_SECONDS | 1800 | Connection lifetime. |
POSTGRES_MIGRATION_TIMEOUT_SECONDS | 0 | No overall migration deadline; positive values are limited to 86400 seconds. Shutdown still cancels. |
POSTGRES_SLOW_QUERY_THRESHOLD_MS | 200 | Positive slow-query threshold. Each slower statement logs a console WARN slow postgres query with its sql_fingerprint; the operation log persists one slow_postgres_query_summary per fingerprint per 60-second window (Telemetry). |
Base Compose keeps PostgreSQL on its private network. Hosted evaluation uses a temporary loopback port selected by Docker.
Compose Server Tuning
The example Compose files pass these PostgreSQL server settings to the postgres service. The defaults suit a small host; the starting values in examples/.env.example suit a dedicated host with about 8 GB of RAM. A changed value applies only after the postgres container is recreated.
| Variable | Server setting | Compose default | Production starting value |
|---|---|---|---|
POSTGRES_SHARED_BUFFERS | shared_buffers | 256MB | 2GB |
POSTGRES_EFFECTIVE_CACHE_SIZE | effective_cache_size | 1GB | 6GB |
POSTGRES_WORK_MEM | work_mem | 8MB | 16MB |
POSTGRES_MAINTENANCE_WORK_MEM | maintenance_work_mem | 128MB | 512MB |
POSTGRES_SHARED_PRELOAD_LIBRARIES | shared_preload_libraries | pg_stat_statements | pg_stat_statements |
POSTGRES_SHM_SIZE | Container /dev/shm size | 256mb | 1gb |
Preloading pg_stat_statements does not create the extension; the Operations Runbook covers that step. These settings arrive with release v2.9.2; see implementation status.
Startup requires a writable primary and rejects unsupported replica/distributed topology, including separate POSTGRES_READ_DSN configuration. Migration phase/count updates and liveness heartbeats follow the migration observation contract. The image healthcheck has a 30-minute start period; extend startup/rollout grace for longer migrations. Budget connections across all replicas.
Embedding Provider And Contract
| Variable | Application default | Meaning |
|---|---|---|
AI_API_URL, AI_API_KEY | Required | OpenAI-compatible embedding endpoint/key. |
AI_API_EMBEDDING_MODEL, AI_API_EMBEDDING_DIMENSIONS | Required | Model and response dimensions. |
AI_API_EMBEDDING_TIMEOUT_SECONDS | 30 | Provider ceiling within operation deadline. |
AI_API_EMBEDDING_MAX_CONCURRENCY | 8 | Process-wide provider concurrency. |
AI_API_EMBEDDING_MAX_BATCH_ITEMS | 256 | Texts per upstream HTTP request. |
An application batch preserves ordered results across upstream chunks. A failed chunk fails the whole batch; transient retries share the existing bounded retry allowance. Use 100 items where required by providers such as Workers AI BGE-M3.
Changing the configured model or dimensions is not an online vector migration. Startup checks the persisted contract. See ANN, HNSW, And Halfvec.
Search Index Construction
Bootstrap derives strategy from dimensions and persists compatible embedding/index/projection identities. Current construction uses HNSW m=16, ef_construction=64, query bootstrap ef_search=40, and a 200-candidate bound; execution can raise query search breadth for that bound. These are server-owned parameters, not a public ranking mode.
Physical limits and strategies are owned by ANN, HNSW, And Halfvec.
Assessor
| Variable | Application default | Meaning |
|---|---|---|
AI_VERIFIER_API_URL | Embedding base URL | Assessment endpoint; explicitly separate URLs do not inherit the embedding key. |
AI_VERIFIER_API_KEY | Embedding key when using its endpoint | Assessment credential. |
AI_VERIFIER_MODEL | Required | Assessment model. |
AI_REMEMBER_MODEL | Verifier model | Optional Remember/session model override. |
AI_VERIFIER_DISABLE_TEMPERATURE | false | Omit the temperature argument. |
AI_VERIFIER_TIMEOUT_SECONDS | 60 | Provider timeout within remaining operation/phase budget. |
AI_VERIFIER_MAX_CONCURRENCY | 5 | Process-wide provider gate. |
AI_VERIFIER_MAX_INPUT_TOKENS | 200000 | Complete assessment request/history bound. |
AI_VERIFIER_MAX_OUTPUT_TOKENS | 65536 | Response acceptance bound. |
AI_VERIFIER_MAX_CANDIDATE_CONTEXT_TOKENS | 50000 | Candidate-context bound. |
AI_VERIFIER_TOKENIZER | o200k_base | Accounting tokenizer. |
Set limits that the configured model supports. Bounds include schema, instructions, context, and regeneration history. Processing order and complete-response retries are defined in Memory Write Pipeline.
Typed Decision Providers
These startup settings are independent; enabled decision providers never inherit credentials:
| Variable | Default or requirement |
|---|---|
AI_DECISION_PROVIDER | disabled; supported enabled values are openai and typesafe. |
AI_DECISION_API_URL, AI_DECISION_API_KEY, AI_DECISION_MODEL | Required when enabled. |
AI_DECISION_MAX_INPUT_TOKENS | Explicit positive per-request limit when enabled. |
AI_DECISION_MAX_QUESTION_INPUT_TOKENS | Explicit positive limit; OpenAI defaults it to the configured input limit. Cannot exceed request limit. |
AI_DECISION_TIMEOUT_SECONDS | 10; maximum 86400. |
AI_DECISION_MAX_CONCURRENCY | 4; maximum 128. |
AI_DECISION_LONG_CONTEXT_ENABLED | false; TypeSafe only. |
TypeSafe configuration is capped at 64000 request / 32000 question tokens by default, or 262000 for both with explicit long-context opt-in. These are configured request ceilings, not measurements of provider capability or latency.
Settings → Decisions stores six independent preferences and optional input budget overrides.
| Capability | Key |
|---|---|
| Intake | DECISION_DEDUPLICATION_ENABLED, DECISION_SECURITY_REVIEW_ENABLED, DECISION_CONFLICT_REVIEW_ENABLED |
| Organization | DECISION_TOPIC_ASSIGNMENT_ENABLED controls assignment, consolidation, and Evidence equivalence; DECISION_COMMUNITY_PLACEMENT_ENABLED controls Community placement. |
| Recall | DECISION_RECALL_RERANKING_ENABLED |
Missing preferences default true after successful settings load. Effective enablement requires a configured Decision provider. Explicit false persists. On refresh failure the last valid snapshot is marked stale. Required work fails when no valid snapshot is available.
Set DECISION_MAX_INPUT_TOKENS for a request and DECISION_MAX_QUESTION_INPUT_TOKENS for its shared state plus one question. Each override must be a positive integer, and the question limit cannot exceed the request limit. Clearing an override restores its startup AI_DECISION_* value. New operations use the saved settings within five seconds.
The portal displays the effective limits and any saved value that exceeds the active provider's ceiling. Correct or clear an invalid override before starting Decision work. OpenAI's model input capacity does not establish its Decisions endpoint limit. Requests are bounded to 64 MiB, and operator diagnostics explicitly report when the 16 MiB capture limit prevents retaining a payload.
These runtime settings describe application revision f786f02390fb. Check the application revision in your deployment before using them.
Recall Search Modes
| Startup variable | Default | Effect |
|---|---|---|
RECALL_EXPANSION_ENABLED | false | Adds bounded term and current shared Topic expansion before optional reranking. |
RECALL_DISABLE_QUERY_EMBEDDING | false | Runs the lexical Recall arm without embedding the question. Remember still requires write embeddings. |
See Recall Ranking.
Topic Maintenance
These are runtime app_config keys edited in the control portal:
| Key | Default or bound |
|---|---|
TOPIC_MAINTENANCE_ENABLED | false. |
TOPIC_MAINTENANCE_CADENCE_HOURS | 12; accepts 12 or 24. |
TOPIC_MAINTENANCE_START_TIME_LOCAL | 03:00, strict HH:MM. |
TOPIC_MAINTENANCE_MODEL | Empty; optional composed-model override. |
TOPIC_MAINTENANCE_MAX_CONCURRENCY | 1; range 1–8. |
TOPIC_MAINTENANCE_TEAM_MAX_CONCURRENCY | 1; range 1–8. |
TOPIC_MAINTENANCE_TEAM_OVERRIDES_JSON | Empty list; at most 128 unique team overrides, each concurrency 1–8. |
TOPIC_MAINTENANCE_CONTEXT_WINDOW_TOKENS | Empty until configured; 1–1000000000, and must leave room for output. |
APP_TIMEZONE | General runtime timezone, set under Settings → General; Local until changed. The startup APP_TIMEZONE variable is validated but does not set this key. |
Configure the model's full request context, including response headroom. Topic-vector backfill uses the active embedding contract and batches up to 256 Topics; the configured embedding provider still controls its upstream request size. Manager Save makes no embedding or Decision call. The Topic storage upgrade migrates all eight supported ONTOLOGY_MAINTENANCE_* settings to the corresponding TOPIC_MAINTENANCE_* keys. See Topics And Organization and Operations Runbook.
Redis, Rate Limits, And Streams
| Variable | Default |
|---|---|
REDIS_ADDR, REDIS_PASSWORD | Empty. |
REDIS_DB | 0. |
REDIS_TLS_ENABLED, DISTRIBUTED_COORDINATION_REQUIRED | false. |
HTTP_MAX_BODY_BYTES | 1048576. |
AUTH_VERIFY_MAX_CONCURRENCY | 8. |
RATE_LIMIT_PER_MINUTE | 100. |
SSE_HEARTBEAT_SECONDS, SSE_MAX_DURATION_SECONDS | 30, 300. |
SSE_MAX_CONCURRENT_STREAMS | 10. |
Multiple instances require shared coordination. Redis failure cannot silently switch a distributed deployment to independent process counters. Deployment procedures are in Public HTTPS And Redis.
Runtime SSO, OAuth, And Private Memory
| Runtime key | Default |
|---|---|
SSO_PUBLIC_BASE_URL, SCIM_PUBLIC_BASE_URL, CONTROL_PUBLIC_BASE_URL, MCP_PUBLIC_BASE_URL | Empty. |
SSO_ENTITLEMENT_CACHE_TTL_SECONDS | 300. |
SSO_SESSION_TTL_SECONDS | 28800. |
SSO_STATE_TTL_SECONDS | 600. |
SSO_HTTP_TIMEOUT_SECONDS | 10. |
SSO_COOKIE_SECURE | Derived from SSO public URL; set true for public HTTPS. |
PRIVATE_MEMORY_RETENTION_DAYS | 0 disables scheduled retention; allowed 0–36500. |
Use canonical origins without credentials, queries, or fragments. The MCP base permits local HTTP for localhost/127.0.0.1. SCIM/control ingress uses HTTPS. Provider secrets are environment-backed references, not exposed runtime values. See User Portal SSO. A valid MCP_PUBLIC_BASE_URL can also activate built-in MCP sign-in; see MCP OAuth authority.
MCP OAuth Authority
Release v2.9.2 introduces the built-in MCP OAuth authorization server; see implementation status.
MCP_PUBLIC_BASE_URL is a runtime app_config key, not a startup environment variable. Edit it in the control portal under Settings → SSO runtime → MCP public base URL. It accepts an absolute https URL of up to 2048 characters, or http for a loopback host, with an optional canonical literal path and no credentials, query, or fragment. The saved value drops a trailing slash. The pending application change #885 narrows the path: each segment may contain only letters, digits, ., _, ~ and -, both when the value is saved and when stored settings load. Run the base path upgrade check before upgrading to an image that includes it.
One resolver selects the OAuth authority for MCP discovery:
| Condition, checked in order | Authority | RFC 9728 / RFC 8414 discovery and /oauth/* |
|---|---|---|
| Provider list or configuration cannot be read | unavailable | 503 |
| An enabled SSO provider enables Accept OAuth JWTs on MCP | external | Customer IdP issuers; built-in endpoints 404 |
| An enabled protected-resource provider is invalid, including a blank issuer | unavailable | 503 |
MCP_PUBLIC_BASE_URL is non-empty and invalid | unavailable | 503 |
MCP_PUBLIC_BASE_URL is empty | dormant | 404; API keys still work |
MCP_PUBLIC_BASE_URL is valid and no external provider applies | builtin | Built-in authorization server is active |
An unavailable authority never falls back to built-in mode. Repair the invalid provider or base URL, or disable Accept OAuth JWTs on MCP on that provider when built-in mode is intended. External-provider settings are in User Portal SSO. The control portal reports the resolved mode; see Operations Runbook.
| Deployment detail | Requirement |
|---|---|
| SSO sign-in during consent | The consent page is served under the MCP origin and reads the SSO browser session. Use the same origin for SSO_PUBLIC_BASE_URL and MCP_PUBLIC_BASE_URL; otherwise only team-API-key consent works. The control status reports whether the origins match. |
| Base path | A path such as https://memory.example.com/dense-mem applies to discovery, /oauth/*, the consent redirect, and cookie paths. The /ui bundle still loads its assets from /ui/ at the origin root, so a proxy that publishes Dense-Mem under a path must also serve /ui/ at the root or rewrite it. Subpath-mounted /ui assets are not supported. |
Base Path Upgrade Check
The pending application change #885 rejects a stored MCP_PUBLIC_BASE_URL whose path contains any other character, such as :, @, ;, or a percent-escape. Such a path cannot be carried by the consent cookie or the consent page route. After an upgrade to an image that includes the change, loading app config fails until the value is repaired. With a decision provider configured, the server does not start.
Run this check against the database before upgrading, and repair any returned value first. app_config uses forced row-level security, so the check sets system mode; without it a role that is not a superuser sees no rows.
BEGIN;
SET LOCAL app.tx_mode = 'system';
SELECT value FROM app_config
WHERE key = 'MCP_PUBLIC_BASE_URL' AND value <> ''
AND value !~* '^https?://[^/]+(/[A-Za-z0-9._~-]+)*/?$';
ROLLBACK;If an upgrade skipped the check:
| State | Repair |
|---|---|
| The server starts (no decision provider configured) | Call PATCH /control/api/config/sso with {"items":[{"key":"MCP_PUBLIC_BASE_URL","value":"<new URL>"}]}. The control portal settings form cannot load in this state. Until the repair, built-in OAuth reports unavailable with public_base_url_invalid. |
| The server does not start (decision provider configured) | Roll back to the previous image and repair the value there. This works only when the upgrade applied no migration newer than that image; #885 adds none. As a last resort, update the row with SQL under system mode, which skips validation and audit. Expect UPDATE 1; UPDATE 0 means system mode was not set. |
The startup failure logs ERROR decision.settings.unavailable with reason_code=no_valid_snapshot. A running server logs WARN oauth authority runtime config failed with stage=oauth_discovery. Both error fields name MCP_PUBLIC_BASE_URL and the rule; see MCP OAuth diagnostics.
Private Session Ingestion
SESSION_INGEST_ENABLED is a startup boolean, default false. Restart after changes. Intake reuses configured extraction/assessment, tokenizer, provider-concurrency, and embedding owners. Missing required capabilities make the tool unavailable. Disablement stops new intake while preserving compatible durable history.
Recall Feedback
| Runtime key | Default |
|---|---|
RECALL_FEEDBACK_ENABLED | false. |
RECALL_FEEDBACK_RETENTION_DAYS | 30; range 1–365. |
Feedback behavior belongs to Recall Feedback.
Telemetry And Logging
| Startup variable | Default |
|---|---|
LOG_LEVEL | trace; accepts trace/debug/info/warn/warning/error/fatal. |
TELEMETRY_ENABLED | false. |
TELEMETRY_PROMETHEUS_URL, TELEMETRY_PROMETHEUS_JOB | Empty. |
TELEMETRY_QUERY_TIMEOUT_SECONDS | 5. |
TELEMETRY_SCRAPE_TOKEN | Required when telemetry is enabled. |
fatal records severity without exiting. OPERATION_LOG_RETENTION_DAYS is a runtime key, default 30, range 1–365. Rate-card keys are TELEMETRY_COST_VERIFIER_INPUT_USD_PER_MILLION_TOKENS, TELEMETRY_COST_VERIFIER_OUTPUT_USD_PER_MILLION_TOKENS, TELEMETRY_COST_EMBEDDING_INPUT_USD_PER_MILLION_TOKENS, and TELEMETRY_COST_MODEL_PRICES_JSON. Operational interpretation belongs to Telemetry.
Enterprise Exports
| Startup variable | Default or requirement |
|---|---|
OTLP_ENABLED | false; requires telemetry and at least one endpoint. |
OTLP_TRACE_ENDPOINT, OTLP_METRIC_ENDPOINT | Empty; full independent HTTP(S) destination URLs. |
OTLP_TRACE_HEADERS_FILE, OTLP_METRIC_HEADERS_FILE | Empty; explicitly mounted JSON header files. |
AUDIT_EXPORT_ENABLED, DIAGNOSTIC_BUNDLE_ENABLED | false; gate private administrative downloads. |
Destination URLs reject credentials, queries, and fragments. Header files allow at most 16 valid headers within 8192 bytes. Values participate in operational credential protection and are not exposed in config serialization. Export bounds and content contracts belong to Telemetry.