Skip to main content
Use these endpoints to directly manage the memory store — save insights explicitly, list stored memories, delete outdated entries, and import or export your full memory database for backup or migration. These endpoints give you precise control over what Agent Memory retains, independent of the automatic hook-capture pipeline.

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. Returns 201 Created on success.

Request

string
required
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.
string
Memory classification. One of:
  • pattern — a recurring code pattern or approach
  • preference — a developer or team preference
  • architecture — an architectural decision
  • bug — a known bug or gotcha
  • workflow — a workflow or process step
  • fact — a general factual statement
Defaults to fact if not supplied.
string
Project name to scope this memory. If set, the memory is included in project-scoped recalls and profile queries.
string[]
Concept tags used to improve retrieval. These are indexed separately from the content and used by the BM25 and graph search streams.
string[]
Related file paths. Used by the enrichment and file-context endpoints to surface this memory when the agent opens these files.
number
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.
string[]
IDs of observations that this memory was derived from. Provides provenance — you can trace any memory back to the raw session event.

Response

string
Unique identifier for the saved memory. Use this to retrieve, evolve, or delete the memory later.
number
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 by memoryId (removes a specific long-term memory) or by sessionId (removes all observations for a session).
Forget operations are logged in the audit trail but are not reversible unless you have a snapshot created with POST /agentmemory/snapshot/create beforehand.

Delete a specific memory

Delete all observations for a session

You can also pass both sessionId and observationIds together to delete specific observations within a session:
string
ID of a long-term memory to delete. Required unless sessionId is provided.
string
Session ID to clear. Removes all observations for the session. Required unless memoryId is provided.
string[]
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, use limit and offset to page through results.

Response


GET /agentmemory/memories/:id

Retrieves a single memory by its ID.
Returns { "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.
string
required
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.
string
required
ID of the memory to evolve.
string
required
The updated memory content. The previous version is stored and linked as a supersedes relation.
string
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.
For large corpora, paginate using maxSessions and offset:

Response

The response is an ExportData object containing:

POST /agentmemory/import

Imports memory data from a previous export. Wrap the ExportData object in an exportData field:
object
required
An ExportData object from a previous GET /agentmemory/export call.
string
Import conflict strategy. One of:
  • merge (default) — combine imported data with existing data
  • replace — replace existing data with the import
  • skip — skip any records that already exist

GET /agentmemory/audit

Returns the full audit trail of memory operations — every remember, forget, consolidate, evolve, import, export, and governance operation, with timestamps, function IDs, target memory IDs, and agent IDs.

Response

Use the audit trail before bulk-deleting memories via POST /agentmemory/governance/bulk-delete. The operation filter lets you review what Agent Memory has been doing automatically on your behalf.

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. Supports dryRun=true to preview what would be deleted.

Memory Consolidation

POST /agentmemory/consolidate

Manually triggers the 4-tier memory consolidation pipeline. Requires CONSOLIDATION_ENABLED=true and a configured LLM provider.
Returns 503 with { "flag": "CONSOLIDATION_ENABLED", "enableHow": "..." } if consolidation is not enabled.

POST /agentmemory/consolidate-pipeline

Runs a specific consolidation tier. Accepts an optional tier field ("working", "episodic", "semantic", "procedural").

POST /agentmemory/evict

Evicts memories that have decayed below the retention threshold. Supports ?dryRun=true to preview evictions.