Skip to main content

Overview

Update an existing observation by ID. Only the fields you provide are changed — all other fields remain unchanged. Use this when you have the exact observation ID and need to correct or refine it.
This tool is part of the agent profile and uses deferred loading to optimize performance.

When to Use

  • Corrections — fix typos, inaccuracies, or missing details in an existing observation
  • Refinements — add more context or clarification to a previously saved memory
  • Reclassification — change the type or scope of an observation
  • Topic key updates — assign or change the topic key for upsert behavior
Only use mem_update when you have the exact observation ID. If you’re updating evolving knowledge (like architecture decisions), use mem_save with a topic_key instead.

Parameters

id
number
required
Observation ID to updateGet the ID from:Example: 42
title
string
New title for the observationExample: "Fixed FTS5 syntax error on special chars [updated]"
content
string
New content for the observationUse the same What/Why/Where/Learned format as mem_save:
**What**: [updated description]
**Why**: [updated reasoning]
**Where**: [updated file paths]
**Learned**: [updated insights]
type
string
New observation type/categoryRecognized types:
  • decision
  • architecture
  • bugfix
  • pattern
  • config
  • discovery
  • learning
  • manual
project
string
New project nameChange which project this observation is associated with.
scope
string
New visibility scopeOptions:
  • project — project-scoped
  • personal — cross-project personal knowledge
topic_key
string
New topic key (normalized internally)Assign or change the topic key for upsert behavior. Format: family/segmentExample: architecture/database-schema-design

Response

result
string
Confirmation message with updated observation details
Example:
Memory updated: #42 "Fixed FTS5 syntax error on special chars [updated]" (bugfix, scope=project)

Usage Examples

Update Title

{
  "id": 42,
  "title": "Fixed FTS5 query sanitization [refined]"
}
Updates only the title. All other fields remain unchanged.

Update Content

{
  "id": 42,
  "content": "**What**: Wrapped each search term in quotes AND escaped internal quotes\n**Why**: Users typing queries with apostrophes like \"user's profile\" would crash\n**Where**: internal/store/store.go — sanitizeFTS() function\n**Learned**: FTS5 requires both quoting AND escaping. Nested quotes need special handling."
}
Replaces the content with updated details. Title, type, and other fields stay the same.

Change Type and Scope

{
  "id": 12,
  "type": "pattern",
  "scope": "personal"
}
Reclassifies observation #12 as a personal pattern (cross-project knowledge).

Assign Topic Key

{
  "id": 87,
  "topic_key": "architecture/auth-model"
}
Assigns a topic key to enable future upserts via mem_save.

Update Multiple Fields

{
  "id": 42,
  "title": "FTS5 query sanitization [comprehensive fix]",
  "type": "bugfix",
  "content": "**What**: Added quote wrapping, escaping, and operator detection\n**Why**: Multiple edge cases caused crashes — apostrophes, quotes, boolean operators\n**Where**: internal/store/store.go — sanitizeFTS() function, added comprehensive test suite\n**Learned**: FTS5 has complex quoting rules. Regex-based sanitization is safer than manual escaping."
}
Updates title, type, and content. Project and scope remain unchanged.

Partial Updates

Only the fields you provide are updated. All other fields remain unchanged:
Field ProvidedResult
titleTitle updated, content/type/project/scope unchanged
contentContent updated, title/type/project/scope unchanged
typeType updated, all other fields unchanged
title + contentBoth updated, type/project/scope unchanged
You can update one field or many — it’s a partial update, not a full replacement.

Validation

If the observation ID doesn’t exist, you’ll get an error:
Failed to update memory: observation not found
Use mem_search to find the correct ID.
You must provide at least one field to update:
{
  "id": 42
}
Error:
provide at least one field to update
If you provide topic_key, it’s normalized internally:
  • Lowercased
  • Spaces replaced with hyphens
  • Special characters removed
Input: "Architecture / Database Schema Design"Stored: "architecture/database-schema-design"

Difference from mem_save with topic_key

Featuremem_updatemem_save with topic_key
Requires IDYes — you must know the exact IDNo — finds observation by topic_key
Use caseCorrect a specific observationUpdate evolving knowledge
ScopeUpdates by ID (ignores topic_key match)Updates by topic_key + project + scope
Best forTypo fixes, refinements, correctionsArchitecture decisions, living docs
Use mem_update when you have an exact ID. Use mem_save with topic_key for evolving topics.

What Changes

When you update an observation:
  • Specified fields are replaced with new values
  • Updated timestamp (updated_at) is refreshed
  • Revision count does NOT increment (only topic_key upserts increment revisions)
  • Duplicate count is NOT affected
  • Created timestamp remains unchanged

Build docs developers (and LLMs) love