Skip to main content
Glama

memory_edit

DestructiveIdempotent

Edit an existing memory in place with exact search/replace or update only its description and tags, avoiding a full rewrite and leaving the body untouched.

Instructions

Edit an existing memory in place with exact search/replace, instead of resending its whole body through memory_write. Each edit's old_string must match the current body exactly and uniquely (or pass replace_all); all edits apply together or none do, so a failed match changes nothing. It is also the only way to change a memory's description or tags on their own: send description/tags_add/tags_remove with no edits and the body is left untouched (memory_write requires a body, so there was no metadata-only path before this), and tags_remove is the only way to clear a tag at all. Returns a unified diff of what landed plus the new content_hash. Use this for corrections that do not change what the item CLAIMS: typos, broken formatting, a stale path or command, a stage's Status flip, metadata. If the MEANING changes -- the conclusion is now different, the advice reversed -- that is a new memory: use memory_write with supersedes, which retires the old one into readable history instead of erasing what it used to say.

Input Schema

NameRequiredDescriptionDefault
nameYesmemory name (kebab-case, as memory_read takes it)
editsNoordered list of exact search/replace edits, applied in order to the CURRENT body. Each is {old_string, new_string, replace_all?}. old_string must match the body EXACTLY (whitespace and indentation included) and must be unique unless replace_all is true; include surrounding lines to make it unique. All-or-nothing: if any edit fails to match, nothing is written.
projectNoproject slug; defaults to the bound/ambient session's project, then global. Pass project=global to target a global memory.
sessionNothe session to act as: the name session_start returned, the cc/<id> or cx/<id> on your briefing's 'Seam session' line, or a session ULID. It scopes and credits this call. Defaults to this connection's session; pass it on every call when session_start reports the connection as stateless
tags_addNotags to add, leaving the rest in place (a comma-separated string is also accepted)
descriptionNoreplace the one-line description (<=150 chars -- the only text shown in indexes); omit to leave it untouched
expect_hashNooptional precondition: the content_hash you last read for this item (memory_read/notes_read return it). The write is refused if the stored file has changed since -- another agent or the owner edited it -- so re-read and re-apply your change instead of overwriting theirs. Omit it to write unconditionally.
tags_removeNotags to remove, leaving the rest in place; this is how a tag gets cleared (a comma-separated string is also accepted)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.7.4
    • addedInput schema / properties / session
      Added value: +{
      +  "description": "the session to act as: the name session_start returned, the cc/<id> or cx/<id> on your briefing's 'Seam session' line, or a session ULID. It scopes and credits this call. Defaults to this connection's session; pass it on every call when session_start reports the connection as stateless",
      +  "type": "string"
      +}
  2. Addedv0.4.11

TDQS

A4.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare destructiveHint=true, idempotentHint=true, readOnlyHint=false, so the safety profile is covered; the description does not contradict them. It does add real behavioral context beyond annotations: all-or-nothing atomicity ('all edits apply together or none do'), failed match changes nothing, and the return value (a unified diff plus content_hash). Since annotations carry the safety information, this is supplemental rather than load-bearing, so a 3 fits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads the core purpose and the search/replace mechanism, then routes to memory_write. The volume is high for one tool definition, but nearly every sentence carries routing or constraint information; only the parenthetical about memory_write requiring a body is arguably redundant.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, and the description compensates by stating the return value (unified diff plus new content_hash). With 8 parameters, a destructive annotation, and metadata-only behavior all addressed, an agent has everything needed to call the tool and interpret the result.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3 and the schema already documents old_string/new_string/replace_all/expect_hash. The description does add cross-parameter semantics the schema cannot express: sending description/tags_add/tags_remove with no edits leaves the body untouched, and tags_remove is the only way to clear a tag. That is meaningful value beyond the per-field docs.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Edit an existing memory in place with exact search/replace') and immediately differentiates the tool from memory_write by mechanism and cost ('instead of resending its whole body'). An agent can distinguish it from every sibling without opening a schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit routing rule: corrections that do not change what the item CLAIMS (typos, formatting, stale paths, status flips, metadata) go here; changes in MEANING go to memory_write with supersedes. It also names a case where this tool is the only option (metadata-only edits, clearing a tag), which is precise when-to-use guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.