---
title: "Context settings reference"
---

# Context settings reference

Every environment variable of the Context Platform, with defaults, bounds and what happens when a value is invalid.

The Context Platform is configured on the Govern server with environment variables. All are optional. A configuration error never stops the server: retrieval answers `503 context.misconfigured`, or only the affected feature's routes answer `503`, as noted below. `GET /api/v1/context/status` (organisation administrators) shows `configurationValid`.

## Embeddings and search

No embeddings endpoint is configured by default: search is full-text only.

| Variable | Default | Meaning |
|---|---|---|
| `KEYSTONE_CONTEXT_EMBEDDINGS_URL` | unset | OpenAI-compatible base URL (`.../v1`); unset means full-text only |
| `KEYSTONE_CONTEXT_EMBEDDINGS_MODEL` | none | Model name; required with the URL |
| `KEYSTONE_CONTEXT_EMBEDDINGS_DIMENSIONS` | none | Vector size, 1 to 65536; required with the URL; every response is checked |
| `KEYSTONE_CONTEXT_EMBEDDINGS_API_KEY` | unset | Bearer key |
| `KEYSTONE_CONTEXT_EMBEDDINGS_SEND_DIMENSIONS` | | `true` sends `dimensions` in the request |
| `KEYSTONE_CONTEXT_EMBEDDINGS_EXTERNAL` | automatic | `true`: the endpoint is outside the deployment; `false`: inside. Unset: external unless the host is loopback or in the internal hosts list |
| `KEYSTONE_CONTEXT_EMBEDDINGS_INTERNAL_HOSTS` | empty | Hosts that count as inside the deployment: names, `*.suffix`, IPs or CIDRs, comma-separated |
| `KEYSTONE_CONTEXT_EMBEDDINGS_BATCH_SIZE` | 64 | Inputs per request, 1 to 2048 |
| `KEYSTONE_CONTEXT_EMBEDDINGS_MAX_RETRIES` | 4 | Retries after `429`, `5xx` or a transport error, 0 to 10 |
| `KEYSTONE_CONTEXT_SEARCH_BACKEND` | `sql` | `sql` (exact cosine in SQL) or `pgvector` (needs the extension; missing, retrieval fails closed) |
| `KEYSTONE_CONTEXT_IVFFLAT_PROBES` | 10 | Probes of the `pgvector` backend, 1 to 100 |
| `KEYSTONE_CONTEXT_LEVEL_WEIGHTS` | built-in | Default level weights, `level=weight,...` (subproject, project, team, department, bu, org, group, user) |

Confidential and restricted content is never sent to an external endpoint, whatever these settings say. See [Retrieval](https://neuralinverse.com/docs/context/retrieval/).

## Indexing and GitHub

| Variable | Default | Meaning |
|---|---|---|
| `KEYSTONE_CONTEXT_CHUNK_MAX_TOKENS` | 400 | Chunk size; `0` turns the indexer off (adding or re-indexing content then answers `503 context.indexer.not_configured`) |
| `KEYSTONE_CONTEXT_DEFAULT_EXCLUDES` | built-in list | Path patterns excluded from every codebase source; replaces the default list; `none` for no default exclusions |
| `KEYSTONE_CONTEXT_GITHUB_HOSTS` | `github.com` | Allowed GitHub hosts, comma-separated; add your GitHub Enterprise host |
| `KEYSTONE_CONTEXT_GITHUB_APP_SECRET_PATH` | `secret/data/keystone/context/github-app` | Keystone Vault KV version 2 path of the organisation's GitHub App secret |

## Collaboration

| Variable | Default | Meaning |
|---|---|---|
| `KEYSTONE_CONTEXT_LENSES_PER_OWNER` | 500 | Live lenses one person owns (1 to 100,000) |
| `KEYSTONE_CONTEXT_LENSES_PER_ORG` | 20,000 | Live lenses of one organisation, system lenses excluded (1 to 1,000,000) |
| `KEYSTONE_CONTEXT_SNAPSHOTS_PER_HOUR` | 200 | Snapshots one person creates per hour (1 to 10,000) |
| `KEYSTONE_CONTEXT_PENDING_SHARE_TTL` | 14 days | Lifetime of a share waiting for approval, 1 hour to 30 days; a malformed value turns pending shares off |
| `KEYSTONE_CONTEXT_TARGETS_PER_MINUTE` | 30 | Share target lookups per person |
| `KEYSTONE_CONTEXT_PROJECT_LOOKUPS_PER_MINUTE` | 60 | Project lookups per person (1 to 600); a malformed value keeps the default |

## Team memory

| Variable | Default |
|---|---|
| `KEYSTONE_CONTEXT_MEMORY_MAX_UPDATE_BYTES` | 65536 |
| `KEYSTONE_CONTEXT_MEMORY_MAX_TEXT_BYTES` | 65536 |
| `KEYSTONE_CONTEXT_MEMORY_MAX_UNITS` | 262144 |
| `KEYSTONE_CONTEXT_MEMORY_MAX_UPDATES_PER_ENTRY` | 50000 |
| `KEYSTONE_CONTEXT_MEMORY_UPDATES_PER_MINUTE` | 240 |
| `KEYSTONE_CONTEXT_MEMORY_ENTRIES_PER_SPACE` | 5000 |
| `KEYSTONE_CONTEXT_MEMORY_COMPACT_AFTER` | 256 |

Meanings are on [Team memory](https://neuralinverse.com/docs/context/team-memory/).

## Real-time feed

A malformed value turns only the feed and presence routes into `503 context.events.unavailable`. Durations use Go syntax (`30s`, `15m`).

| Variable | Default | Meaning |
|---|---|---|
| `KEYSTONE_CONTEXT_EVENTS_MAX_CONNS_PER_USER` | 5 | Open streams per user and replica |
| `KEYSTONE_CONTEXT_EVENTS_MAX_CONNS_PER_ORG` | 200 | Open streams per organisation and replica |
| `KEYSTONE_CONTEXT_EVENTS_BACKLOG_MAX` | 1000 | Most events a resume replays |
| `KEYSTONE_CONTEXT_EVENTS_RETENTION` | `24h` | How long events stay replayable (1m to 720h) |
| `KEYSTONE_CONTEXT_EVENTS_KEEPALIVE` | `10s` | Keep-alive comment interval |
| `KEYSTONE_CONTEXT_EVENTS_HEARTBEAT` | `30s` | Heartbeat event interval |
| `KEYSTONE_CONTEXT_EVENTS_REFRESH` | `10s` | Authorisation re-check interval (the revocation bound) |
| `KEYSTONE_CONTEXT_EVENTS_BUFFER` | 1024 | Events queued per stream before a slow client is dropped |
| `KEYSTONE_CONTEXT_EVENTS_WRITE_TIMEOUT` | `10s` | Longest a write to a client may block |
| `KEYSTONE_CONTEXT_EVENTS_MAX_AGE` | `15m` | Lifetime of one stream |
| `KEYSTONE_CONTEXT_EVENTS_POLL` | `2s` | Fallback poll interval |
| `KEYSTONE_CONTEXT_PRESENCE_TTL` | `30s` | Lifetime of a presence entry between heartbeats |

## Work registry

A malformed value turns only the registry's routes into `503 context.work.unavailable`.

| Variable | Default |
|---|---|
| `KEYSTONE_CONTEXT_WORK_TTL` | `15m` |
| `KEYSTONE_CONTEXT_WORK_PAUSED_TTL` | `24h` |
| `KEYSTONE_CONTEXT_WORK_MAX_ITEMS_PER_USER` | 25 |
| `KEYSTONE_CONTEXT_WORK_MAX_ITEMS_PER_ORG` | 5000 |
| `KEYSTONE_CONTEXT_WORK_MAX_AREAS` | 200 |
| `KEYSTONE_CONTEXT_WORK_CHECKS_PER_MINUTE` | 60 |
| `KEYSTONE_CONTEXT_WORK_RETENTION_DAYS` | 400 |
| `KEYSTONE_CONTEXT_WORK_RECONCILE` | `@every 1m` (`off` disables the abandonment job) |

## Related settings outside the Context Platform

| Variable | Meaning |
|---|---|
| `NI_OBSERVABILITY_SIGNING_KEY` | Keys the HMAC evidence chain that holds retrieval attributions. Required; keep it stable |
| `KEYSTONE_MODELS_CONTEXT_LINK_WAIT_MS` | How long the model gateway waits for a retrieval's attribution record before answering `not_found` (default 750, 0 to 10000) |
