Skip to main content

Runtime Settings

Most configuration flags bind once at startup. A curated subset can be overridden at runtime via the /admin/settings page, the mr admin settings CLI, or the /v1/admin/settings HTTP API -- no restart required.

How precedence works​

  1. Boot flag / env var supplies the initial value.
  2. If the runtime_settings table has a row for the key, that override wins.
  3. When an override differs from the boot value (flag, env var, or built-in default), one WARN line is logged at startup. Secret settings report status without printing either value.

Reset via the UI (Reset button), CLI (mr admin settings reset <key>), or API (DELETE /v1/admin/settings/<key>) removes the override and returns to the boot value.

Runtime-editable settings​

KeyTypeBoundsBoot flagTakes effect
max_upload_sizeint64 (bytes)1 KiB–1 TiB; 0 = unlimited-max-upload-sizenext upload request
upload_concurrencyint1–16(runtime only)next page render
upload_widget_file_thresholdint1–10000(runtime only)next page render
upload_widget_size_thresholdint64 (bytes)1 MiB–1 TiB(runtime only)next page render
max_import_sizeint64 (bytes)1 MiB–1 TiB-max-import-sizenext import parse
mrql_default_limitint1–100000-mrql-default-limitnext MRQL query
mrql_page_query_budgetint0–100000; 0 disables-mrql-page-query-budgetnext page render
mrql_query_timeoutduration100ms–5m-mrql-query-timeoutnext MRQL query
export_retentionduration1m–30d-export-retentionnext sweep + UI disclosure
remote_connect_timeoutduration1s–10m-remote-connect-timeoutnext remote download
remote_idle_timeoutduration1s–1h-remote-idle-timeoutnext remote download
remote_overall_timeoutduration10s–24h-remote-overall-timeoutnext remote download
remote_user_agentstringat most 8192 bytes, no control characters; empty = browser-like default-remote-user-agentnext remote download
download_failed_retentionduration1h–365d-download-failed-retentionnext history sweep
download_history_retentionduration1h–365d-download-history-retentionnext history sweep
download_cockpit_limitint1–200-download-cockpit-limitnext page load (Jobs drawer finished rows)
share_public_urlstring (http/https URL)absolute http/https URL; empty = relative /s/<token> only-share-public-urlnext share link render
docs_site_base_urlstring (http/https URL)absolute; non-empty host-docs-site-base-urlnext page render
docs_links_disabledint0–1; 1 hides links-docs-links-disablednext page render
hash_similarity_thresholdint0–11 (v2 pairs stored up to distance 11)-hash-similarity-thresholdnext hash comparison
hash_ahash_thresholduint640–64; 0 disables-hash-ahash-thresholdnext hash comparison
hash_backfill_pausedint0–1; 1 pauses the v2 backfill(runtime only)next backfill cycle
job_replay_retentionduration1h–365d(runtime only)next Job replay sweep
job_history_retentionduration1h–365d-job-history-retentionnext Job history sweep
job_attention_retentionduration1h–365d-job-attention-retentionnext Job history sweep
job_pin_limitint1–10000-job-pin-limitnext pin

AI providers, models and credentials​

The AI generation section at /admin/settings configures DeepSeek, OpenRouter, OpenAI and Anthropic. Save one credential per provider, then select the provider and model separately for MRQL generation and Template generation. Changes apply to the next generation operation without a restart, even if the server started without a key, and survive a restart. Configuration is shared by the deployment and requires an administrator; generation keeps its existing feature permissions.

Enter the provider's model ID directly. OpenRouter IDs include their namespace (for example, openai/<model>). Saving does not contact the provider or verify model access. Each provider keeps its own saved models, so switching providers cannot accidentally inherit another provider's model. A provider needs both a key and a default model; otherwise generation returns "not configured".

Credential fields are write-only and stay empty after loading or saving. Replace stores a new key; leaving the field untouched preserves it. Clear saves an empty override, disabling the key even when an environment fallback exists. Reset removes the override and restores that fallback. The status reports whether a key is configured, whether a boot key exists and whether an override is present. Keys and key fragments are never returned.

Stored credential overrides are plaintext in the database and its backups, readable by database administrators and the server. The settings API/UI, CLI, audit records and SQL/application diagnostics redact them. Environment fallbacks are DEEPSEEK_API_KEY, OPENROUTER_API_KEY, OPENAI_API_KEY and ANTHROPIC_API_KEY.

These keys also work with the existing settings API and CLI. Replace <provider> with deepseek, openrouter, openai or anthropic, <feature> with mrql or template, and <kind> with slot, pair, plan, bundle or metaschema:

KeyValue
ai_<provider>_api_keySecret string, at most 8192 bytes, no whitespace/control characters; empty clears
ai_mrql_provider, ai_template_providerOne of the four provider IDs; default deepseek
ai_<feature>_<provider>_modelModel ID, at most 256 bytes, no whitespace/control characters
ai_<feature>_<provider>_max_tokens1–65536 output/completion tokens; 0 inherits
ai_<feature>_<provider>_timeoutPositive Go duration up to 10m; 0s inherits
ai_template_<provider>_<kind>_modelOptional kind-specific model; empty inherits the template default
ai_template_<provider>_<kind>_max_tokensOptional kind-specific token cap; 0 inherits
ai_template_<provider>_<kind>_timeoutOptional kind-specific timeout; 0s inherits
ai_template_privacy_modeper-run (default) or always
ai_template_generation_modeharness (default) or classic
ai_template_max_turnsInteger 1–20; default 10
ai_template_run_deadlineGo duration 30s–15m; default 5m
ai_template_run_token_budgetInteger 100000–2000000; default 400000

The last four keys control Generation runs. harness mode lets the model read your data with Tools over several Turns before it submits a draft; classic keeps the single-call draft with repair and whole-template fan-out. ai_template_max_turns caps the Turns of one run, ai_template_run_deadline is its wall-clock limit, and ai_template_run_token_budget is its token budget, in which cached prompt tokens count a quarter. A request reads the four values once, so a change applies to the next request and never alters a run in progress. The Reset button of Template generation resets all four with the other ai_template_* keys; resetting a single key through the API or CLI resets only that key. The key and bounds are defined in application_context/ai_generation.go (addAIHarnessSettingSpecs).

ai_template_privacy_mode controls Privacy mode, which replaces Entity values with Placeholders before template generation sends anything to the provider. With per-run the Disclosure offers it as a checkbox that is ticked for every new run. With always the checkbox is ticked and disabled, and the server refuses any template generation request, dry run included, that turns it off. It applies in both generation modes and does not affect MRQL generation.

The advanced controls show the effective inherited profiles. An explicit kind setting wins over a feature/provider setting, which wins over shipped defaults or DeepSeek boot configuration. OpenRouter, OpenAI and Anthropic default to 8192 tokens and 60s per MRQL/template call, with 16384 tokens and 120s for a single-call bundle. Their whole-template planning/fan-out deadline is 120s. Reasoning uses the model's defaults and counts against the completion budget. DeepSeek keeps its existing models, thinking, budgets and timeout defaults; see Template generation.

Each operation keeps one settings snapshot through its calls and repairs. Changes do not alter a running generation. A template provider, model or public option change after the disclosure dialog requires reviewing again before Send. Rotating a key alone does not change the public disclosure hash. The same eight template provider slots and existing rate limits apply across configuration changes.

Reset for a generation feature atomically removes its provider selection and all its provider-specific model/budget/timeout overrides, restoring boot defaults. It preserves the credentials. A single-key CLI/API reset only resets that key.

PUT /v1/admin/settings saves an atomic batch of string values and resets:

{
"values": {
"ai_mrql_provider": "openai",
"ai_mrql_openai_model": "<your-model-id>"
},
"reset": [],
"reason": "Use the selected OpenAI model for MRQL"
}

Omitted keys are preserved. The response is the full sanitized settings list. Invalid entries or database failures save nothing. A key cannot appear in both values and reset. GET /v1/admin/settings/ai-profiles returns the selected providers and effective non-secret call profiles. Settings are cached per server process; a write does not automatically refresh another running process.

Metadata index build status​

Indexed keys are configured in each resource category, group category, or note type editor, alongside its metadata schema. See indexed metadata keys.

The Metadata index builds section on this page shows background build status and errors. GET /v1/admin/settings/metadata-index-status exposes the same status for administrators. Saved category changes are normally picked up within five seconds. Failed builds retry after a minute; each reconciliation has a 30-minute budget. PostgreSQL concurrent builds interrupted by shutdown are repaired on retry or restart.

Bulk resource uploads​

max_upload_size bounds one request body. That distinction matters on the create-resource page, which has two ways of submitting:

  • Native post - the browser sends every selected file in one multipart body, so max_upload_size caps the batch as a whole.
  • Client-side widget - above upload_widget_file_threshold files or upload_widget_size_threshold bytes, the page sends one request per file, upload_concurrency at a time, with a progress bar and per-file errors. Each file is then capped individually, and the widget refuses an oversized file in the browser rather than spending the transfer to be rejected.

All three are read when the create-resource page renders and embedded in the form, so a change applies to the next page load rather than to an upload already in flight.

Set upload_widget_file_threshold to 1 to put every multi-file selection through the widget. SQLite has exactly one writer, so upload_concurrency above about 3 buys little there; Postgres tolerates more.

Audit trail​

Every change writes a row to log_entries with entity_type=runtime_setting, the key as entity_name, old→new values in message, and the request IP in ip_address. Secret entries record redacted values. Visible at /logs (filter entity type runtime_setting), or via GET /v1/logs.

CLI reference​

See mr admin settings.