Memory Banks
Overview
Memory banks give your agents persistent memory. Each bank stores embedded entries that agents can write to, search, and load across runs — enabling patterns like preference learning, progressive summarization, and context enrichment.
There are two types of memory banks:
- Conversation — stores dialogue turns keyed by
keyandspeaker. Ideal for chat history, multi-turn dialogue, and per-session context. - General — stores standalone knowledge keyed by
key(no speaker). Ideal for long-term facts, persona definitions, and entity extraction.
Both types use the same unified agent steps — Write Memory, Search Memory, and Load Memory — which accept a key parameter that maps to the appropriate key field based on bank type.
A memory bank controls:
- Embedding configuration — model, vector dimensions, chunk size/overlap
- Compaction settings — a prompt and thresholds that trigger automatic summarization
- Retention — how long entries are kept before automatic cleanup
Memory banks are created and managed from the Memory Banks page in the dashboard, or via the Public API and MCP tools.
Types
Every memory bank has a type that determines what kind of entries it stores and which agent steps can use it.
| Type | Key Field | Speaker | Agent Steps | Best For |
|---|---|---|---|---|
| Conversation | key | Yes | Write Memory, Search Memory, Load Memory | Dialogue history, chat sessions, per-user conversations |
| General | key | No | Write Memory, Search Memory, Load Memory | Standalone knowledge, facts, preferences, entity extraction |
Conversation banks model multi-turn dialogue. Each entry records who said what with a speaker field, and the Load Memory step can retrieve the entire thread in order — making it suitable for chat history, progressive summarization, and agent prompt injection as messages.
General banks store standalone knowledge entries. There is no speaker, and entries are grouped by key for scoping. Use general banks for long-term facts, persona definitions, extracted entities, and any non-conversational data.
The type is set at creation time (or auto-selected by the template) and cannot be changed after creation.
Creating a Memory Bank
- Navigate to Memory Banks in the sidebar
- Click Create Memory Bank
- Choose a template to prepopulate recommended settings, or click Use AI assistant to describe what you need and let it suggest a configuration
- Set a name, mode, compaction prompt, and retention
- Optionally click Test Prompt next to the compaction prompt to verify it produces good summaries before creating the bank
- Click Create
The bank's content source (where entries are physically stored) is provisioned automatically when the bank is created — no manual source or knowledge base setup required.
Templates
Templates prepopulate the form with recommended settings for common memory patterns:
| Template | Type | Best For | Mode | Retention |
|---|---|---|---|---|
| Working Memory | Conversation | Active task context — requirements, decisions, next steps | Fast & Cheap | 7 days |
| Short Term Memory | Conversation | Current conversation session context | Balanced | 30 days |
| Long Term Memory | General | User preferences, history, and patterns across sessions | Slow & Thorough | Indefinite |
| Persona Memory | General | Consistent agent personality and role definition | Balanced | Indefinite |
| Episodic Memory | Conversation | Task sequences, outcomes, and lessons learned | Balanced | 90 days |
| Entity Memory | General | People, places, organizations, and events | Slow & Thorough | Indefinite |
Templates are starting points — all settings can be customized after selection.
Modes
The mode controls the embedding dimensions and chunking parameters:
| Mode | Dimensions | Chunk Size | Chunk Overlap | Trade-off |
|---|---|---|---|---|
| Fast & Cheap | 256 | 2000 | 400 | Lowest cost, fastest search, less nuanced recall |
| Balanced | 512 | 1500 | 300 | Good middle ground for most use cases |
| Slow & Thorough | 1024 | 1000 | 200 | Best recall quality, higher cost and slower search |
| Custom | Choose your own | Choose | Choose | Full control over the embedding model and chunking |
Mode cannot be changed after creation because the content source's embedding dimensions are locked once provisioned.
Detail Page
Opening a memory bank shows a detail page with three tabs:
- Entries — Statistics dashboard showing how entries are distributed across conversations/groups, speakers, tags, and time
- Agents — Lists all agents that currently reference this memory bank, with links to open each agent
- Configuration — All editable settings (name, description, compaction prompt, thresholds, retention), plus the AI Assistant, Test Compaction Prompt, content source management, and the Delete button
Entry Statistics
The Entries tab shows aggregated statistics (not individual entries) to help you understand how the bank is being used and whether compaction settings need tuning.
Use the time frame selector at the top to filter statistics to a specific date range (default: last 30 days).
- Summary cards — Total entries, unique conversations (or groups), unique speakers (conversation banks only), date range, and compaction summary count (when compaction has occurred) with the last compaction timestamp
- Distribution metrics — Token count, entry age, and entries-per-key distributions showing average, p95, min, and max values — useful for spotting outliers and tuning compaction thresholds
- Breakdown tables — Top conversations/groups by entry count, top speakers, and top tags
These statistics are computed server-side. Individual entry content can be viewed from the linked content source.
Compaction
Compaction prevents memory from growing without bound. Configure a compaction prompt that tells the system how to summarize entries when a threshold is reached.
Triggers — compaction runs when any threshold is exceeded:
| Threshold | Description |
|---|---|
| Max Age (days) | Compact entries older than this many days |
| Max Size (tokens) | Compact when total token count exceeds this |
| Max Turns | Compact when entry count exceeds this |
If no thresholds are set, compaction never runs and entries accumulate indefinitely (subject to retention cleanup).
When compaction runs — compaction is triggered in two ways:
- Inline after writes — every time an agent writes a new entry via Write Memory, the system checks the thresholds for that partition and compacts immediately if any are exceeded.
- Scheduled sweep — an hourly background job checks all memory banks with at least one compaction trigger configured. For each bank, every partition (conversation key or group key) is evaluated independently against the thresholds. This ensures entries that cross an age threshold are compacted even when no new writes are occurring.
Both paths are fully automatic — no manual action is required. You can also trigger compaction on-demand from the Configuration tab using the Compact Now button, or via the API (POST /memory_banks/{id}/compact) and MCP (compact_memory_bank_now tool).
How compaction works — when entries are compacted, they are soft-deleted and (if a compaction prompt is configured) summarized into a new entry that preserves the essential information. The summary entry is tagged so it can be distinguished from user-written entries. Compaction is applied per-partition (per conversation key or per group key), so each conversation or group is evaluated independently.
Disabling compaction — to disable a specific threshold, set it to 0 via the API or MCP (max_age_days: 0). In the UI, simply clear the field and save. To disable compaction entirely, clear all three thresholds and optionally clear the compaction prompt.
Testing Compaction
Use the Test Compaction Prompt feature (available on both the create page and the Configuration tab) to preview how a compaction prompt performs before committing to it. The test flow:
- Choose a content source — existing entries from the bank, generate synthetic entries from a description, or paste custom entries directly
- Click Run Test to execute the compaction summarizer
- Review the results: original entries, compacted summary, surviving entries, and a structured quality evaluation scored by an LLM-as-judge
This lets you iterate on the compaction prompt until you are satisfied with the summary quality. Entries configured with custom roles (system, user, assistant) are supported for conversation banks.
AI Assistant
The AI Assistant can suggest configuration changes for your memory bank. Available from both the create page (as Use AI assistant) and the Configuration tab:
- Describe what you want the memory bank to do in plain language
- The assistant suggests a compaction prompt, thresholds (max age, max size, max turns), and retention
- Review the suggestions and apply them with one click
This is useful when you are not sure what compaction prompt or thresholds to use for your use case.
Retention
Retention controls how long entries are kept before automatic deletion. Choose a preset duration (1 week, 1 month, 3 months, 1 year), select Custom and enter any number of days, or choose Indefinite to keep entries forever. Retention is set at creation time and can be updated later from the Configuration tab.
Content Source
Each memory bank has a linked content source (a system-managed source connection). The source is eagerly provisioned when the bank is created — it is available immediately, before any entries are written. Entries are stored as content versions inside this source, embedded and chunked according to the bank's configuration.
The content source is managed from the Configuration tab of the detail page:
- View Source — Opens the content source detail page where you can browse individual entries
- Delete Source — Removes all stored entries and resets the bank's data. The source connection is re-provisioned automatically the next time an agent writes to the bank
Using Memory Banks in Agents
Once created, use a memory bank in your agent's steps:
- Open the agent editor
- Add a Write Memory, Search Memory, or Load Memory step
- Select a memory bank from the dropdown (both conversation and general banks are shown)
- Configure the
keyand other fields — for conversation banks, also set thespeaker
See Agent Steps → Memory for full details on all memory step types.
API Access
Memory banks can be managed programmatically via the Public API using your API key:
# List memory banks (filter by type with ?type=conversation or ?type=general)
curl "https://api.seclai.com/memory_banks?type=conversation" \
-H "X-API-Key: $SECLAI_API_KEY"
# List pre-built templates
curl https://api.seclai.com/memory_banks/templates \
-H "X-API-Key: $SECLAI_API_KEY"
# Create a memory bank (with optional description)
curl -X POST https://api.seclai.com/memory_banks \
-H "X-API-Key: $SECLAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "My Memory Bank", "description": "Stores customer context", "type": "conversation", "mode": "balanced"}'
# Get a memory bank
curl https://api.seclai.com/memory_banks/$MEMORY_BANK_ID \
-H "X-API-Key: $SECLAI_API_KEY"
# Update a memory bank
curl -X PUT https://api.seclai.com/memory_banks/$MEMORY_BANK_ID \
-H "X-API-Key: $SECLAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Renamed Bank", "compaction_prompt": "Summarize concisely"}'
# Delete a memory bank
curl -X DELETE https://api.seclai.com/memory_banks/$MEMORY_BANK_ID \
-H "X-API-Key: $SECLAI_API_KEY"
# Delete a memory bank's content source (reset data)
curl -X DELETE https://api.seclai.com/memory_banks/$MEMORY_BANK_ID/source \
-H "X-API-Key: $SECLAI_API_KEY"
# List agents using a memory bank
curl https://api.seclai.com/memory_banks/$MEMORY_BANK_ID/agents \
-H "X-API-Key: $SECLAI_API_KEY"
# Get entry statistics (last 30 days by default, or specify a range)
curl "https://api.seclai.com/memory_banks/$MEMORY_BANK_ID/stats?days=30" \
-H "X-API-Key: $SECLAI_API_KEY"
# Test a compaction prompt against an existing bank
curl -X POST https://api.seclai.com/memory_banks/$MEMORY_BANK_ID/test-compaction \
-H "X-API-Key: $SECLAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"compaction_prompt": "Keep only essential facts."}'
See API Examples → Memory Banks for more examples.
MCP Tools
All memory bank operations are available as MCP tools for AI coding assistants:
| Tool | Description |
|---|---|
list_memory_bank_templates | List pre-built template configurations for common use cases |
list_memory_banks | List memory banks with pagination and sorting |
get_memory_bank | Get full details of a memory bank |
create_memory_bank | Create a new memory bank |
update_memory_bank | Update a memory bank's configuration |
delete_memory_bank | Delete a memory bank |
delete_memory_bank_source | Delete a bank's content source (reset data) |
get_agents_using_memory_bank | List agents that reference a specific memory bank |
get_memory_bank_stats | Get aggregated entry statistics for a memory bank |
test_compaction_prompt | Test a compaction prompt with LLM-as-judge evaluation |
See MCP Server → Memory Bank Tools for setup instructions.
Exporting
Export a memory bank's entries and configuration as a downloadable JSON file.
- UI: Open the memory bank detail page and click the Export button. You'll see an estimate of the export size before confirming.
- API:
POST /authenticated/resource-exportswithresource_type: "memory_bank"and the memory bank ID. - MCP: Use the
create_resource_exporttool withresource_type: "memory_bank".
See Export Formats → Memory Bank for the full file schema and available filter options.
Next Steps
- Agent Steps → Memory — Full reference for Write Memory, Search Memory, and Load Memory steps
- Agents Overview — Back to the agents overview
- API Examples — Code samples for working with memory banks programmatically
- MCP Server — Use memory bank tools from AI coding assistants