Memory and Context
Configure cross-conversation memory graphs, background extraction, and single-summary context compression
Clouisle uses two layers to keep conversations continuous while bounding cost:
- In-conversation context (message branch + single context summary): the live history of an ongoing session. When the assembled request exceeds budget, the system compresses the older history into one generated summary and keeps the recent stretch verbatim, so the model window never overflows.
- Cross-conversation Memory Graph: a persistent knowledge network of entities and directional relations that retains user preferences, project background, and core facts across separate conversations.
There is no separate "conversation summary" subsystem and no three-tier (warning / selective / blocking) compression: compression produces exactly one artifact — a model-generated context summary. The memory feature is itself the entity/relation graph, not an accumulation of raw conversation text.
Enable Cross-Conversation Memory
- Open the Agent's Orchestration > Memory.
- Turn on Enable Memory (
enable_memory, off by default). - Set the maximum number of memories per retrieval, range
1-50, default10. - Turn on Auto-extract Memories as needed; it is on by default.
- Save and publish the Agent. When a user chats across different conversations, the Agent automatically recalls previously stored facts.
The Agent's memory configuration (memory_config):
| Field | Default | Range | Description |
|---|---|---|---|
max_memories_per_retrieval | 10 | 1-50 | Maximum entities injected into the model per memory retrieval |
auto_extract | true | Boolean | Auto-extract and store memories from conversations; turning it off leaves only the read tools |
importance_threshold | medium | low / medium / high | Minimum importance for auto-extracted memories |

The Memory Graph
Persistent memory is a directed topological knowledge graph of Entities and Relations, not a flat blob of text.
You can inspect and manage your memory graph visually under the user menu > My Memories (/app/memories) or in the admin dashboard (/memories).
Image needed: Memory graph canvas
File: /images/memory-graph-canvas.png. Screenshot content: the interactive memory graph canvas showing entity nodes, relation edges, layout switchers (Grid, Hierarchical, Radial), and the entity detail drawer. Crop the screenshot to the canvas area and outline the selected entity node with the theme color. The future alt and caption for this image will both use "Memory graph canvas".
Entity Types
The system predefines 10 entity types:
| Entity Type | Description | Examples |
|---|---|---|
preference | Personal user preference or working habit | "Prefers concise code style", "Uses TypeScript by default" |
project | Active initiative or work assignment | "Storefront redesign", "Internal documentation portal" |
person | Mentioned individual or stakeholder | "Manager Zhang (Product Lead)" |
organization | Company, department, or external group | "Engineering Dept", "Vendor Alpha" |
skill | Tech competency or specialization | "Python", "PostgreSQL performance tuning" |
goal | Milestone target or user intent | "Launch multilingual docs this quarter" |
fact | Concrete fact or environment attribute | "Production cluster deployed in Tokyo datacenter" |
concept | Domain concept or technical term | "RAG hybrid retrieval" |
location | Location or physical site | "Shanghai R&D Center" |
custom | Extensible custom entity | User-defined custom tags |
Relation Types
Entities connect through 9 directional relation types used during graph traversal:
| Relation Type | Meaning |
|---|---|
prefers | User prefers this entity |
uses | Uses this tool, library, or method |
works_on | Contributes to this project or task |
works_at | Employed at this company or institution |
knows | Familiar with this person or subject |
part_of | Belongs to a higher-level entity |
has_goal | Pursuing this objective |
located_in | Situated at this physical site |
related_to | Associated with another concept |
Graph Management Capabilities
- Multiple layout engines: switch between Grid, Hierarchical, and Radial layouts, with zoom in, zoom out, and Fit View controls.
- Search & filtering: search entities by name or description keywords, or filter by entity type.
- Relation drawer: select any entity to inspect its Outgoing and Incoming relations, edit its JSON property dictionary, or remove specific edges.
- Bulk and safe deletion: use Select Mode to batch-delete outdated or sensitive entities. Deleting an entity automatically cleans up all its associated relations and vector embeddings.
Memory Retrieval and Recency Decay
When an Agent retrieves memory, it balances semantic similarity with exponential recency decay using a weighted score:
Combined score = (1 - w) × similarity + w × recency
- Recency calculation: exponential half-life decay (
exp(-ln2 / half-life × days)) with a default half-life of 30 days (memories untouched for 30 days score half the temporal value). - Weighting: the recency weight
wdefaults to0.15(similarity accounts for0.85), balancing relevance with freshness. - Time window filtering: callers can pass
time_window_daysto restrict retrieval to memories created or touched within the last N days. - Subgraph expansion: after finding candidate entities, the retriever expands outward
1-3hops (max_depth, default1; at most5seed entities; directionincoming/outgoing/both) to supply a connected contextual subgraph to the LLM.
Background Memory Extraction
Administrators configure background extraction under Site Settings > Memory (/site-settings/memory):
| Setting | Default | Constraint | Description |
|---|---|---|---|
memory_async_extraction_enabled | false | Boolean | Global switch for background extraction |
memory_extraction_model_id | empty | String | Model used for extraction; falls back to the default model chain when empty |
memory_extraction_cooldown_seconds | 180 | 10-3600s | Debounce interval to avoid spamming extraction runs |
memory_extraction_max_pending_turns | 6 | 1-50 turns | Triggers extraction immediately once pending turns hit this threshold |
Extraction queues only when the Agent has Enable Memory and Auto-extract Memories enabled in its orchestration AND the administrator has enabled background extraction globally.
How Long Conversations Are Compressed
Context compression is on by default (context_compression_config.enabled = true) and performs exactly one kind of work: handing the older history to a model to generate a single summary (policy preflight_summary), replacing that history with the summary and keeping the most recent stretch verbatim.
Budget calculation
Compression computes the usable input budget from the model context window:
input budget = context window − output reserve − safety margin
- Context window: taken from the model's own configuration; falls back to
32000when absent. - Output reserve: defaults to
4000, capped tomin(4000, model max output, context window ÷ 3). - Safety margin: fixed at
1000.
Trigger condition
The summary is generated when the assembled request exceeds the trigger budget:
trigger budget = min(context window − max(window × 15%, output reserve), input budget)
For the default 32,000 window: output reserve 4,000, safety margin 1,000, input budget 27,000, so the trigger budget is min(32000 − 4800, 27000) = 27000 — roughly 84% of the window. The trigger_ratio constant reported in SSE events is fixed at 0.9, but the trigger budget above is what actually decides when compression runs.
Retention and generation
- Verbatim tail: keeps up to the newest
20000tokens of history, clamped so the system prompt, summary, current turn, and output reserve all fit. The newest turn is always kept; rounds whose tool calls are still open are never cut. - Summary length:
1000tokens by default (summary_max_tokens, range128-8000), truncated to whatever the budget allows. - Retries: at most
3attempts,2seconds apart,180seconds each; if all fail the call returnscontext_summarization_failed. - Persistence: the summary text and its watermark (the last covered message) live on the conversation (
context_summary_text/context_summary_watermark_id); later turns reuse and incrementally update the same summary instead of stacking new ones. - Still over budget after summarizing: raises
ContextLengthError(retryable: false, reasoncontext_summary_did_not_fit) instead of retrying indefinitely.
When emit_sse_events is true (the default), streaming APIs send compression_start and compression_end so clients can explain the reorganization; compression_end carries before_tokens, after_tokens, input_budget, summary_saved_tokens, and related fields.
API Endpoints
# List memory entities (filtered by entity_type with pagination)
GET /api/v1/memories/entities?page=1&page_size=20&entity_type=preference
# Create / read / update / delete an entity
POST /api/v1/memories/entities
GET /api/v1/memories/entities/{entity_id}
PUT /api/v1/memories/entities/{entity_id}
DELETE /api/v1/memories/entities/{entity_id}
# List / create / delete relations
GET /api/v1/memories/relations?entity_id={entity_id}&relation_type=uses
POST /api/v1/memories/relations
DELETE /api/v1/memories/relations/{relation_id}
# Fetch full or localized subgraph
GET /api/v1/memories/graph?entity_ids={id1}&entity_ids={id2}&max_depth=2Troubleshooting
- Preferences not remembered: confirm the Agent has memory enabled, the facts reached the importance threshold, and you are logged in as the same user.
- Early details ignored: long sessions may have compressed early history into the summary; restate key constraints or start a new conversation.
- Frequent compression: inspect the model context window, output reservation, and tool result sizes — large tool payloads fill the budget faster.
- Inaccurate facts recorded: navigate to
/app/memories, locate the faulty entity via search, and click Edit or Delete.
How is this guide?