Feature flags¶
Many Spongram behaviours are switched by an environment variable. This page lists every switch with its default in the code, the default set by the server image, the editions it applies to and what it changes, then shows how to flip one on Compose, on Swarm and with the Helm chart. Numeric tunables are in Configuration.
Reading the tables¶
- Code: what the service does when the variable is absent.
- Image: the value set by an
ENVline ofspongram_proxy/Dockerfile. It applies to every container started from the server image unless the service environment overrides it. A dash means the image does not set the variable. - Stack: the fallback written in
docker/docker-stack.ymlwhen it differs from both. The Compose file's fallbacks are noted in the text where they exist.
The rule followed by the code: a new feature is off when its variable is absent, and with the
variable off the service behaves exactly as it did before the feature existed. A fix is on by
default and is turned off only by an explicit false value (0, false, no, off), so that a
typo cannot disable it. Features that every server deployment is expected to run are then turned
on in the image.
A flag is read from the environment of the process: every change needs a container restart.
Background workers¶
| Variable | Code | Image | Editions | What it changes |
|---|---|---|---|---|
SPONGRAM_SLEEPER_ENABLED |
off | 1 |
server | Starts the Sleeper, which writes entity summaries in the background. Costs LLM calls on the Sleeper model. Accepts only 1, true or yes in lower case |
SPONGRAM_DREAM_ENABLED |
off | 1 |
server | Starts the Dream, the periodic consolidation pass (probable duplicates, neighbour re-summary, fact confidence). Same accepted values |
SPONGRAM_PERSONA_SUMMARY_ENABLED |
off | true |
server, desktop | The Sleeper also compiles a summary of what each persona knows. One LLM call per persona whose set of memories changed |
SPONGRAM_DREAM_RESOLVE_ENABLED |
off | — (stack: true) |
server, desktop | The Dream links same-name entities with a non-destructive SAME_AS relation |
SPONGRAM_DREAM_FORGETTING_ENABLED |
off | — | server, desktop | The Dream stamps forgotten_at on facts whose decayed score fell below SPONGRAM_DREAM_FORGET_FLOOR. Only elapsed time triggers it: a fact with a single source is stamped after roughly ten weeks whether or not it was read since. Nothing is deleted and search ignores the stamp. Leave it off unless you have decided what the stamp is for |
In the desktop edition the Sleeper and the Dream are started by the application itself,
independently of the two *_ENABLED variables above.
See Sleeper and Dream.
Search¶
| Variable | Code | Image | Editions | What it changes |
|---|---|---|---|---|
SPONGRAM_HOT_CACHE_ENABLED |
off | — (stack: true) |
server, desktop | Caches search_nodes and search_memory_facts responses in memory for SPONGRAM_HOT_CACHE_TTL_SEC. A newly written memory can take up to one TTL to appear in a query that is already cached |
SPONGRAM_PAGERANK_ENABLED |
off (on in the desktop edition) | — (stack: true) |
server, desktop | Re-ranks search results with Personalized PageRank over the neighbourhood of the first hits. Falls back to the original order when the subgraph query fails or times out |
SPONGRAM_RERANK_LEXICAL_ENABLED |
off | — (stack: true) |
server, desktop | Adds a final lexical re-ranking stage after PageRank |
SPONGRAM_HIDE_INVALID_FACTS |
on | — | server, desktop | search_memory_facts drops facts that are expired or invalidated. The number dropped is reported in _spongram.hidden_invalid |
SPONGRAM_READ_SCOPING_ENABLED |
off | true |
server, desktop | Search tools accept a scope argument and filter results by the tags of their episodes. The number filtered is reported in _spongram.filtered |
SPONGRAM_PROJECT_ALIASES_ENABLED |
off | true |
server, desktop | Per-brain project aliases, applied at read time, and the three alias tools. Has no effect on search unless read scoping is on |
SPONGRAM_CORROBORATION_RANKING_ENABLED |
off | true |
server, desktop | In search_memory_facts, a fact confirmed by several projects may move up, by at most one place per additional project. The set of facts returned does not change, only their order |
SPONGRAM_EPISODES_CHRONO_ENABLED |
on | — | server | get_episodes is answered from the graph, newest first. Off: the call is forwarded to Graphiti, which orders by identifier |
See Search and Project aliases.
Ingestion and tagging¶
| Variable | Code | Image | Editions | What it changes |
|---|---|---|---|---|
SPONGRAM_CLIENT_TAG_ENABLED |
on | — | server, desktop | Adds client=claude-code or client=codex to a memory, from the X-Spongram-Client header, when the memory has no client= tag. An existing tag is never changed |
SPONGRAM_TOPIC_SCOPING_ENABLED |
off | true |
server, desktop | Untagged memories from clients other than coding agents are filed under project=desktop-inbox instead of project=global, and those clients are instructed to derive a topic slug per conversation. Memories from Claude Code are not affected |
SPONGRAM_CONSTITUTION_ENABLED |
off | — (stack: true) |
server, desktop | Rejects an add_memory without a project= tag (and, if SPONGRAM_CONSTITUTION_ALLOWED_CLIENTS is set, without an allowed client= tag) before it is queued |
SPONGRAM_DISTILL_ENABLED |
off | true |
server, desktop | Enables POST /v1/memory/distill, which extracts durable facts from a session transcript. Off: the route answers 503. One LLM call on the Graphiti model per capture |
SPONGRAM_INFERENCE_RETRY_ENABLED |
on | — | server, desktop | The inference proxy retries transient provider errors inside a time budget. Off: a single attempt |
SPONGRAM_DELETE_KEEPS_CONFIRMED_FACTS |
on | — | desktop | Deleting an episode keeps the facts that other episodes still support. The server does not need it: its Graphiti version already behaves that way |
See Ingestion and Tagging and scope.
Personas, marketplace and explorers¶
| Variable | Code | Image | Editions | What it changes |
|---|---|---|---|---|
SPONGRAM_PERSONAS_ENABLED |
off | true |
server, desktop | Personas: the persona tables are read, the persona tools appear in tools/list, the /v1/personas routes are mounted. Off: none of that exists |
SPONGRAM_MARKETPLACE_ENABLED |
off | true |
server | The persona marketplace routes and the admin UI page. Requires SPONGRAM_PERSONAS_ENABLED. Never mounted in the desktop edition |
SPONGRAM_CORTEX_ACTIVITY_ENABLED |
off | true |
server, desktop | Searches are published to the Cortex explorer stream as event: activity, which lights up the nodes a search touched. The bus is in the memory of one process |
GET /admin/api/spongram/features returns {"personas": …, "marketplace": …} as the running
service sees them; the admin UI uses it to show or hide the marketplace entry.
See Personas, Persona marketplace and
Cortex and Wiki.
Operations¶
| Variable | Code | Image | Editions | What it changes |
|---|---|---|---|---|
SPONGRAM_RUN_MIGRATIONS |
on | — | server | The container applies pending SQL migrations before starting. Off in the Cloud overlays and the Helm chart, where a separate job runs them |
SPONGRAM_LANGFUSE_ENABLED |
on when unset | — (stack: false) |
server | Kill switch of LLM tracing. Tracing also needs the Langfuse URL and both keys; see Observability |
SPONGRAM_CLOUD_CONTROL_ENABLED |
off | — | server | Enables the Cloud control plane. Not a flag to toggle casually: once brains are managed by it, the service refuses to start with the variable off |
Dependencies between flags¶
SPONGRAM_MARKETPLACE_ENABLEDdoes nothing withoutSPONGRAM_PERSONAS_ENABLED.SPONGRAM_PERSONA_SUMMARY_ENABLEDneedsSPONGRAM_PERSONAS_ENABLEDand a running Sleeper.SPONGRAM_PROJECT_ALIASES_ENABLEDchanges search results only withSPONGRAM_READ_SCOPING_ENABLED.SPONGRAM_RERANK_LEXICAL_ENABLEDis a stage that runs after PageRank re-ranking.- The hot cache and read scoping can be on together: the cache key includes the scope, the active persona and every filter argument.
- The hot cache, the Cortex activity bus, the project alias cache and the per-brain rate limit live in the memory of one process. They assume the service runs as a single replica.
How to flip a flag¶
Docker Compose¶
The spongram service receives only the variables that docker-compose.yml interpolates. For
those, set the value in .env and recreate the container:
The Compose file interpolates SPONGRAM_SLEEPER_ENABLED (fallback 1),
SPONGRAM_PAGERANK_ENABLED (false), SPONGRAM_HOT_CACHE_ENABLED (false),
SPONGRAM_RUN_MIGRATIONS (true) and the SPONGRAM_THINKING_* variables (off for the three
roles, empty for the per-call one). For any other flag, add it to a
docker-compose.override.yml, which Compose merges automatically:
services:
spongram:
environment:
SPONGRAM_PERSONAS_ENABLED: "false"
SPONGRAM_RERANK_LEXICAL_ENABLED: "true"
Check the result with docker compose exec spongram env | grep SPONGRAM_.
Docker Swarm¶
Immediate change, without rebuilding anything:
The service environment takes precedence over the image ENV, and the service restarts with
its start-first policy. To return to the image default, remove the override:
--env-add does not survive a stack redeploy
The next deployment from the stored stack definition (Portainer webhook, stack update,
docker stack deploy) re-applies that definition and discards the change. To make it
durable, set the stack variable when the stack file interpolates the flag, or add the line
to the environment: block of the spongram service in the stack definition and update
the stack. Put it in that block and not in the shared x-common-env anchor, otherwise the
change also restarts graphiti-mcp.
Helm¶
The chart has no value per flag. The API container loads every key of the Kubernetes Secret
named by api.runtimeSecret as an environment variable. Add the flag to that Secret, then
restart the Deployment:
kubectl -n spongram patch secret spongram-runtime --type merge \
-p '{"stringData": {"SPONGRAM_PERSONAS_ENABLED": "false"}}'
kubectl -n spongram rollout restart deployment/spongram
Variables that the chart sets explicitly on the container (SPONGRAM_RUN_MIGRATIONS,
SPONGRAM_CLOUD_CONTROL_ENABLED and the others listed in AWS) cannot be overridden
from the Secret.
Before and after a flip¶
- Flip one flag at a time and watch the effect before the next one. The workers have delayed effects: a change to the Sleeper or the Dream shows up over the following passes.
- For a flag that costs LLM calls (
SPONGRAM_SLEEPER_ENABLED,SPONGRAM_DISTILL_ENABLED,SPONGRAM_PERSONA_SUMMARY_ENABLED), watch token usage and the ingestion queue depth in/healthz. - For a search flag, the relevant counters are in Observability: cache hits and misses, PageRank outcomes and fallbacks.
- Take a Neo4j backup before enabling a flag that writes to existing facts or entities
(
SPONGRAM_DREAM_RESOLVE_ENABLED,SPONGRAM_DREAM_FORGETTING_ENABLED).