POST /agentmemory/remember
Saves an observation or insight to long-term memory. Use this to explicitly capture decisions, patterns, or facts that you want available in future sessions — even if no session hook fired. Returns201 Created on success.
Request
The memory content to save. Be specific — Agent Memory uses this text for BM25 keyword indexing and vector embedding, so precise wording improves future recall accuracy.
Memory classification. One of:
pattern— a recurring code pattern or approachpreference— a developer or team preferencearchitecture— an architectural decisionbug— a known bug or gotchaworkflow— a workflow or process stepfact— a general factual statement
fact if not supplied.Project name to scope this memory. If set, the memory is included in project-scoped recalls and profile queries.
Concept tags used to improve retrieval. These are indexed separately from the content and used by the BM25 and graph search streams.
Related file paths. Used by the enrichment and file-context endpoints to surface this memory when the agent opens these files.
Number of days after which this memory should begin to decay. Agent Memory will set a
forgetAfter timestamp and evict the memory during the next decay sweep.IDs of observations that this memory was derived from. Provides provenance — you can trace any memory back to the raw session event.
Response
Unique identifier for the saved memory. Use this to retrieve, evolve, or delete the memory later.
Initial memory strength between
0.0 and 1.0. Strength increases each time the memory is recalled and decays over time via the Ebbinghaus curve.POST /agentmemory/forget
Deletes observations or memories. You can delete bymemoryId (removes a specific long-term memory) or by sessionId (removes all observations for a session).
Delete a specific memory
Delete all observations for a session
sessionId and observationIds together to delete specific observations within a session:
ID of a long-term memory to delete. Required unless
sessionId is provided.Session ID to clear. Removes all observations for the session. Required unless
memoryId is provided.Specific observation IDs to delete within the given
sessionId. If omitted, all observations for the session are removed.GET /agentmemory/memories
Lists stored long-term memories with optional filtering and pagination. For large corpora, uselimit and offset to page through results.
| Query param | Type | Description |
|---|---|---|
count | boolean | Return only { total, latestCount } — no memory payload. Useful for status checks. |
latest | boolean | When true, return only the most recent version of each memory (isLatest=true). |
limit | number | Max memories to return (capped at 5000). |
offset | number | Pagination offset (default 0). |
agentId | string | Filter by agent ID. Pass * to bypass scope isolation. |
includeOrphans | boolean | When true, also return memories with no agentId (created before agent scoping was enabled). |
Response
GET /agentmemory/memories/:id
Retrieves a single memory by its ID.{ "memory": Memory } or 404 if the memory does not exist.
GET /agentmemory/profile
Returns the memory profile for a project — the top concepts, most-accessed files, learned conventions, and common error patterns that Agent Memory has built up across all sessions for this project.The project name to retrieve the profile for. Returns
400 if omitted.Response
POST /agentmemory/evolve
Updates an existing memory with new content while preserving its version history. Use this when you learn that a previous memory was incorrect or incomplete. The old version is retained and marked as superseded.ID of the memory to evolve.
The updated memory content. The previous version is stored and linked as a
supersedes relation.Optional new title for the evolved memory.
GET /agentmemory/export
Exports all memory data as a single JSON object. Use this to back up your memory store, migrate to a new machine, or inspect raw state.maxSessions and offset:
| Query param | Type | Description |
|---|---|---|
maxSessions | number | Max sessions to include per page. |
offset | number | Session offset for pagination (default 0). |
Response
The response is anExportData object containing:
POST /agentmemory/import
Imports memory data from a previous export. Wrap theExportData object in an exportData field:
An
ExportData object from a previous GET /agentmemory/export call.Import conflict strategy. One of:
merge(default) — combine imported data with existing datareplace— replace existing data with the importskip— skip any records that already exist
GET /agentmemory/audit
Returns the full audit trail of memory operations — everyremember, forget, consolidate, evolve, import, export, and governance operation, with timestamps, function IDs, target memory IDs, and agent IDs.
| Query param | Type | Description |
|---|---|---|
limit | number | Max audit entries to return (default 50). |
operation | string | Filter by operation type (e.g. remember, forget, consolidate, import, export). |
Response
Governance Endpoints
DELETE /agentmemory/governance/memories
Bulk-deletes specific memories by ID with a mandatory audit log entry.POST /agentmemory/governance/bulk-delete
Bulk-deletes memories matching a filter. SupportsdryRun=true to preview what would be deleted.
| Field | Type | Description |
|---|---|---|
type | string[] | Memory types to delete. |
dateFrom | string | ISO date — only delete memories created after this date. |
dateTo | string | ISO date — only delete memories created before this date. |
qualityBelow | number | Delete memories with a quality score below this threshold. |
dryRun | boolean | When true, returns what would be deleted without actually deleting. |
Memory Consolidation
POST /agentmemory/consolidate
Manually triggers the 4-tier memory consolidation pipeline. RequiresCONSOLIDATION_ENABLED=true and a configured LLM provider.
503 with { "flag": "CONSOLIDATION_ENABLED", "enableHow": "..." } if consolidation is not enabled.
POST /agentmemory/consolidate-pipeline
Runs a specific consolidation tier. Accepts an optionaltier field ("working", "episodic", "semantic", "procedural").
POST /agentmemory/evict
Evicts memories that have decayed below the retention threshold. Supports?dryRun=true to preview evictions.