Skip to main content

Configuration

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 --> Effective

Compose 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

SettingRequirement
POSTGRES_DSN or PostgreSQL componentsWritable single-primary database.
AI_API_URL, AI_API_KEYEmbedding endpoint and credential.
AI_API_EMBEDDING_MODEL, AI_API_EMBEDDING_DIMENSIONSExplicit model and positive compatible dimensions.
AI_VERIFIER_MODELExplicit assessment model.
CONTROL_PORTAL_TOKENControl 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

VariableDefaultMeaning
HTTP_ADDR:8080Main listener.
CONTROL_HTTP_ADDR:8090Separate control listener.
DENSE_MEM_PORT8080 in ComposePublished main port.
CONTROL_PORTAL_BIND127.0.0.1 in expert ComposePublished control address; base Compose fixes loopback.
CONTROL_PORTAL_PORT8090 in ComposePublished control port.

PostgreSQL And pgvector

VariableApplication defaultMeaning
POSTGRES_DSNEmptyFull DSN; otherwise construct from components.
POSTGRES_HOST, POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DBRequired for component configurationConnection components.
POSTGRES_PORT5432Database connection port. Expert Compose uses it as the PostgreSQL host port on loopback.
POSTGRES_SSLMODEdisableDriver TLS mode; configure for deployment.
POSTGRES_MAX_OPEN_CONNS25Per-process pool bound.
POSTGRES_MAX_IDLE_CONNS10Idle pool target.
POSTGRES_CONN_MAX_LIFETIME_SECONDS1800Connection lifetime.
POSTGRES_MIGRATION_TIMEOUT_SECONDS0No overall migration deadline; positive values are limited to 86400 seconds. Shutdown still cancels.
POSTGRES_SLOW_QUERY_THRESHOLD_MS200Positive 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.

VariableServer settingCompose defaultProduction starting value
POSTGRES_SHARED_BUFFERSshared_buffers256MB2GB
POSTGRES_EFFECTIVE_CACHE_SIZEeffective_cache_size1GB6GB
POSTGRES_WORK_MEMwork_mem8MB16MB
POSTGRES_MAINTENANCE_WORK_MEMmaintenance_work_mem128MB512MB
POSTGRES_SHARED_PRELOAD_LIBRARIESshared_preload_librariespg_stat_statementspg_stat_statements
POSTGRES_SHM_SIZEContainer /dev/shm size256mb1gb

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

VariableApplication defaultMeaning
AI_API_URL, AI_API_KEYRequiredOpenAI-compatible embedding endpoint/key.
AI_API_EMBEDDING_MODEL, AI_API_EMBEDDING_DIMENSIONSRequiredModel and response dimensions.
AI_API_EMBEDDING_TIMEOUT_SECONDS30Provider ceiling within operation deadline.
AI_API_EMBEDDING_MAX_CONCURRENCY8Process-wide provider concurrency.
AI_API_EMBEDDING_MAX_BATCH_ITEMS256Texts 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

VariableApplication defaultMeaning
AI_VERIFIER_API_URLEmbedding base URLAssessment endpoint; explicitly separate URLs do not inherit the embedding key.
AI_VERIFIER_API_KEYEmbedding key when using its endpointAssessment credential.
AI_VERIFIER_MODELRequiredAssessment model.
AI_REMEMBER_MODELVerifier modelOptional Remember/session model override.
AI_VERIFIER_DISABLE_TEMPERATUREfalseOmit the temperature argument.
AI_VERIFIER_TIMEOUT_SECONDS60Provider timeout within remaining operation/phase budget.
AI_VERIFIER_MAX_CONCURRENCY5Process-wide provider gate.
AI_VERIFIER_MAX_INPUT_TOKENS200000Complete assessment request/history bound.
AI_VERIFIER_MAX_OUTPUT_TOKENS65536Response acceptance bound.
AI_VERIFIER_MAX_CANDIDATE_CONTEXT_TOKENS50000Candidate-context bound.
AI_VERIFIER_TOKENIZERo200k_baseAccounting 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:

VariableDefault or requirement
AI_DECISION_PROVIDERdisabled; supported enabled values are openai and typesafe.
AI_DECISION_API_URL, AI_DECISION_API_KEY, AI_DECISION_MODELRequired when enabled.
AI_DECISION_MAX_INPUT_TOKENSExplicit positive per-request limit when enabled.
AI_DECISION_MAX_QUESTION_INPUT_TOKENSExplicit positive limit; OpenAI defaults it to the configured input limit. Cannot exceed request limit.
AI_DECISION_TIMEOUT_SECONDS10; maximum 86400.
AI_DECISION_MAX_CONCURRENCY4; maximum 128.
AI_DECISION_LONG_CONTEXT_ENABLEDfalse; 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.

CapabilityKey
IntakeDECISION_DEDUPLICATION_ENABLED, DECISION_SECURITY_REVIEW_ENABLED, DECISION_CONFLICT_REVIEW_ENABLED
OrganizationDECISION_TOPIC_ASSIGNMENT_ENABLED controls assignment, consolidation, and Evidence equivalence; DECISION_COMMUNITY_PLACEMENT_ENABLED controls Community placement.
RecallDECISION_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 variableDefaultEffect
RECALL_EXPANSION_ENABLEDfalseAdds bounded term and current shared Topic expansion before optional reranking.
RECALL_DISABLE_QUERY_EMBEDDINGfalseRuns 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:

KeyDefault or bound
TOPIC_MAINTENANCE_ENABLEDfalse.
TOPIC_MAINTENANCE_CADENCE_HOURS12; accepts 12 or 24.
TOPIC_MAINTENANCE_START_TIME_LOCAL03:00, strict HH:MM.
TOPIC_MAINTENANCE_MODELEmpty; optional composed-model override.
TOPIC_MAINTENANCE_MAX_CONCURRENCY1; range 1–8.
TOPIC_MAINTENANCE_TEAM_MAX_CONCURRENCY1; range 1–8.
TOPIC_MAINTENANCE_TEAM_OVERRIDES_JSONEmpty list; at most 128 unique team overrides, each concurrency 1–8.
TOPIC_MAINTENANCE_CONTEXT_WINDOW_TOKENSEmpty until configured; 1–1000000000, and must leave room for output.
APP_TIMEZONEGeneral 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

VariableDefault
REDIS_ADDR, REDIS_PASSWORDEmpty.
REDIS_DB0.
REDIS_TLS_ENABLED, DISTRIBUTED_COORDINATION_REQUIREDfalse.
HTTP_MAX_BODY_BYTES1048576.
AUTH_VERIFY_MAX_CONCURRENCY8.
RATE_LIMIT_PER_MINUTE100.
SSE_HEARTBEAT_SECONDS, SSE_MAX_DURATION_SECONDS30, 300.
SSE_MAX_CONCURRENT_STREAMS10.

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 keyDefault
SSO_PUBLIC_BASE_URL, SCIM_PUBLIC_BASE_URL, CONTROL_PUBLIC_BASE_URL, MCP_PUBLIC_BASE_URLEmpty.
SSO_ENTITLEMENT_CACHE_TTL_SECONDS300.
SSO_SESSION_TTL_SECONDS28800.
SSO_STATE_TTL_SECONDS600.
SSO_HTTP_TIMEOUT_SECONDS10.
SSO_COOKIE_SECUREDerived from SSO public URL; set true for public HTTPS.
PRIVATE_MEMORY_RETENTION_DAYS0 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 orderAuthorityRFC 9728 / RFC 8414 discovery and /oauth/*
Provider list or configuration cannot be readunavailable503
An enabled SSO provider enables Accept OAuth JWTs on MCPexternalCustomer IdP issuers; built-in endpoints 404
An enabled protected-resource provider is invalid, including a blank issuerunavailable503
MCP_PUBLIC_BASE_URL is non-empty and invalidunavailable503
MCP_PUBLIC_BASE_URL is emptydormant404; API keys still work
MCP_PUBLIC_BASE_URL is valid and no external provider appliesbuiltinBuilt-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 detailRequirement
SSO sign-in during consentThe 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 pathA 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.

sql
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:

StateRepair
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 keyDefault
RECALL_FEEDBACK_ENABLEDfalse.
RECALL_FEEDBACK_RETENTION_DAYS30; range 1–365.

Feedback behavior belongs to Recall Feedback.

Telemetry And Logging

Startup variableDefault
LOG_LEVELtrace; accepts trace/debug/info/warn/warning/error/fatal.
TELEMETRY_ENABLEDfalse.
TELEMETRY_PROMETHEUS_URL, TELEMETRY_PROMETHEUS_JOBEmpty.
TELEMETRY_QUERY_TIMEOUT_SECONDS5.
TELEMETRY_SCRAPE_TOKENRequired 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 variableDefault or requirement
OTLP_ENABLEDfalse; requires telemetry and at least one endpoint.
OTLP_TRACE_ENDPOINT, OTLP_METRIC_ENDPOINTEmpty; full independent HTTP(S) destination URLs.
OTLP_TRACE_HEADERS_FILE, OTLP_METRIC_HEADERS_FILEEmpty; explicitly mounted JSON header files.
AUDIT_EXPORT_ENABLED, DIAGNOSTIC_BUNDLE_ENABLEDfalse; 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.