Context Memory
7 min read
For the end-user explanation of context memory and its behavior in chat, see Context Memory in Unique AI Chat.
Functionality
Context Memory gives every user a single, persistent memory profile shared across all chats and all Unique AI spaces where the feature is enabled. The profile is a compact, structured Markdown file that captures durable user context: identity, communication preferences, work context, skills, recent topics, and open follow-ups.
The Unique AI orchestrator loads the profile before a turn and maintains it after the answer:
Load. A Loading context memory step is opened in chat. The orchestrator resolves
/home-<user_id>/user-memory, falls back to the legacy location for users not yet migrated, and downloadsmemory.mdwhen present. Oversized profiles are condensed and, only if still necessary, hard-truncated. Load failures do not block the turn.Inject. The Markdown profile body is injected into the system prompt under “What I know about you”. Frontmatter remains internal bookkeeping and is not shown to the model.
Answer. The assistant can adapt tone, examples, and depth using the profile. It cannot update memory during the answer.
Gate. After the answer, the postprocessor decides
UPDATEorNOOP. Turns whose only new facts are third-party CID/PII should resolve toNOOP.Consolidate. For
UPDATE, the effective memory model rewrites the full profile under the user-memory content policy.Scrub. Every rewrite passes through a mandatory final CID/PII scrub. The scrub can accept the candidate, return a cleaned and de-identified profile, or veto the write. It fails closed: an error or malformed result keeps the existing memory unchanged.
Cap and persist. A changed, validated profile is fitted to the token budget and upserted as
memory.mdwith ingestion skipped and chat visibility disabled.
Technical Update Flow
Storage Model and Access Control
Memory profiles are stored as Markdown below each user’s private root-level home folder:
/home-<user_id>/
user-memory/
memory.md ← the user’s single memory profileLevel | Access |
|---|---|
| Created by node-ingestion or, when missing, by the user-memory package with an exclusive owner ACL. There is no company-writable shared memory root. |
| Private per-user subfolder that holds the profile. Other users cannot read or write it. |
| Uploaded with |
Because there is exactly one memory file per user, every enabled space loads the same profile. Memory belongs to the user, not to a space or chat.
Security and Content Policy
Storage isolation controls who can access a profile; the content policy controls what may be written into it.
A user-memory profile may contain PII belonging to the signed-in user only.
It must not contain client-identifying data or PII about another user, client, prospect, counterparty, or other private entity. Work facts involving a client are retained only in fully de-identified form.
Credentials, payment data, health records, and government identifiers are never stored, including for the signed-in user.
The same policy is embedded in the gate, consolidation, condensation, and scrub prompts so enforcement cannot drift between write-path stages.
The final scrub is mandatory for every consolidation rewrite and fails closed. If it cannot validate the candidate, the candidate is discarded and the existing profile remains unchanged.
Memory Profile Format
The profile has YAML frontmatter followed by six fixed Markdown sections in the order below. Empty sections use _(empty)_.
Example memory.md
user_id: user_123
schema_version: 1
last_updated: 2026-06-17T12:00:00+00:00
turn_count: 12
---
## Identity
- Works as a credit risk analyst at a Swiss private bank, based in Zurich (CET).
- Native German speaker; communicates with the assistant in English.
## Communication Preferences
- Prefers concise answers with concrete examples.
- Wants tables for numeric comparisons instead of prose.
## Work Context
- Preparing the quarterly IFRS 9 impairment report.
- Migrating team reporting from Excel to a Python-based pipeline.
## Skills & Expertise
_(empty)_
## Follow-ups
- Wants to revisit the scenario-weighting approach next week.
## Recent Topics
- 2026-06-17 11:40 UTC: Discussed expected-credit-loss staging rules.Frontmatter Fields
Field | Meaning |
|---|---|
| The owning user's ID. Preserved across automatic rewrites and hidden from the in-product editor. |
| Profile schema version, currently |
| UTC timestamp of the last automatic consolidation that changed the profile. |
| Incremented by one on each automatic rewrite. |
Sections and Their Meaning
Section | What it captures |
|---|---|
| Stable facts such as name, role, employer, team, timezone, and language. |
| Preferred style, formatting, depth, tone, language, and examples. |
| Current focus areas, active projects, multi-week goals, and deadlines. |
| Competences, tools, languages, and proficiency levels. |
| Explicit hand-offs and topics the user wants to revisit. |
| Recently discussed subjects, dated with |
Configure Context Memory for a Space
Context memory is configured per space and applies to Unique AI spaces.
Enable the feature flag.
FEATURE_FLAG_ENABLE_CONTEXT_MEMORY_UN_22033must be enabled for the company.Open the Space configuration and go to the Configuration step, where the Context memory switch sits alongside the other general space settings. The switch is hidden entirely while the feature flag is off.
Toggle “Context memory”. Newly created spaces start with the switch on while the feature flag is enabled. For every space the setting is opt-in at runtime: an absent key means memory stays off until the space is saved with the switch on.
Save the space. This persists the space-level setting. Memory storage is provisioned privately per user on demand; saving a space no longer creates a company-wide shared
user-memoryroot.
Interaction with Web Search
Context memory and Web Search are mutually exclusive by default. If Web Search is enabled for the space, the Context memory switch is disabled with this tooltip:
Context memory is unavailable while web search is enabled, to keep user data out of external search queries.
Operators can lift the restriction per company with ALLOW_CONTEXT_MEMORY_WITH_WEB_SEARCH_UN_22591. This is an operator environment setting, not a configuration-backend registry flag, and must be set consistently on node-chat and admin-app.
User-Level Opt-Out
Each user controls context memory in Settings → Context Memory. Disabling it sets the user's allowUserMemory preference to false, so memory is neither loaded nor updated in any space for that user.
Current behavior: disabling does not delete the stored memory.md. Re-enabling makes the existing profile available again. The current settings copy that promises permanent deletion does not match the implementation.
Viewing and Editing a Profile
When enabled, Settings → Context Memory resolves the authenticated user’s private /home-<user_id>/user-memory folder and loads memory.md. If the folder does not exist, the private home path can be provisioned for that user. Opening the page with no profile seeds an empty memory.md.
Effective Enablement
Context memory is active for a turn only when every applicable condition below holds:
Condition | Level | Default |
|---|---|---|
| Operator | Off |
Space | Space admin | On for newly created spaces while the feature flag is on; an absent key means off |
Web Search disabled, or | Space admin / operator | Web Search blocks memory |
User | End user | Enabled |
Advanced Configuration
Consolidation is configured per space under Unique AI Services → Context Memory in the assistant's advanced module configuration.
Setting | Default | What it controls |
|---|---|---|
Use Orchestrator Language Model |
| Uses the orchestrator model for the gate, consolidation, mandatory CID/PII scrub, condensation, and matching tokenization. When false, the configured Language Model is used. |
Language Model |
| Used when Use Orchestrator Language Model is false. |
Max Tokens |
| Maximum runtime profile size. Oversized profiles are condensed and then hard-truncated if necessary. |
Consolidation Gate Enabled |
| Runs a cheap |
Token Usage and Analytics
Every language-model call the feature makes is attributed to its own invocation source, so memory cost can be separated from the cost of the answer itself:
Invocation source | When it runs |
|---|---|
| The |
| The full profile rewrite. |
| The mandatory final CID/PII validation and de-identification pass before a rewrite can be persisted. |
| Condensing a stored profile that is already over budget when it is loaded. |
| Condensing a validated rewritten profile that is over budget before upload. |
Each turn also records a context_memory_updated analytics flag: unset when the postprocessor did not run, false when it ran without writing, and true when a changed profile was uploaded.
Limitations
One memory per user, company-wide. There is no per-space or per-chat profile.
Not editable during a response. Automatic updates occur after the final answer. Users can separately edit and save the profile in Settings.
Web Search exclusivity. The features are mutually exclusive by default.
Token budget. Older or low-signal material can be compacted or dropped.
Opt-out is not deletion. The current implementation retains the file when the user disables memory.
Feature Flags and Company Settings
Name | Default | Effect |
|---|---|---|
|
| Per-company master switch from the feature-flag registry. It enables the space toggle, user Settings tab, and |
|
| Operator environment override that allows memory and Web Search together. Accepts |