Skip to content

Search Documentation

Search across all documentation pages

write_memory

Create or upsert a durable memory entry. Supports multiple memory types, importance/confidence scoring, entity extraction, and automatic semantic deduplication.

Memory types: fact (durable knowledge, importance 3-5), skill (procedures/how-tos, 3-5), preference (user style/choices, 2-4), constraint (hard rules/limits, 4-5), task (active work items, 2-4), episodic (session summaries, 1-3), correction (superseded knowledge — always set supersededById, 3-5).

Importance scale: 5=critical, 4=important, 3=standard (default), 2=supplementary, 1=low-value. Confidence scale: 5=verified, 4=observed multiple times, 3=reasonable inference (default), 2=uncertain, 1=speculative.

Server dedup (dedup: true): >92% similarity = skip, >80% = supersede old, <80% = create new.

Parameters#

ParameterTypeRequiredDescription
contentstring (1-1,000,000 chars)requiredMemory content in plain text
memoryTypestringoptionalType: fact, skill, preference, constraint, task, episodic, correction
summarystring (max 500)optionalOptional short summary
vaultIdstring (UUID)optionalVault/project scope. Required unless defaultVaultId is configured.
importanceinteger (1-5)optionalImportance from 1 to 5
confidenceinteger (1-5)optionalConfidence from 1 to 5
agentIdstringoptionalAgent identifier
agentTypestringoptionalAgent type
modelIdstringoptionalModel used to create this memory
agentRunIdstringoptionalAgent run identifier
sourceMessageIdstring (UUID)optionalSource message UUID
writeReasonstringoptionalWhy this memory should be stored
externalWriteIdstringoptionalIdempotency key for upsert behavior
relatedMemoryIdsarrayoptionalLinks to related memories with relation type. Each object: { memoryId: uuid, relationType: "derived_from" | "contradicts" | "refines" | "part_of" | "supersedes" }
sourceNoteIdsstring[] (UUIDs)optionalNote UUIDs this memory was extracted from
supersededByIdstring (UUID)optionalMemory ID that supersedes this one (for corrections)
entitiesstring[]optionalExtracted entity names (people, projects, tools, concepts) for cross-linking
dedupbooleanoptionalRun semantic dedup before writing. >92% match = skip, >80% = supersede old.

Returns#

An object containing the created or matched memory ID, and a status indicating whether the memory was created, skipped (duplicate), or superseded an existing memory.

Example#

json
{
  "tool": "write_memory",
  "arguments": {
    "content": "The organization always uses PostgreSQL instead of MySQL for all database needs.",
    "memoryType": "constraint",
    "importance": 5,
    "confidence": 5,
    "entities": ["PostgreSQL", "MySQL", "database"],
    "writeReason": "Critical infrastructure decision that affects all projects",
    "dedup": true
  }
}