memory_edit
Edit existing memories with exact search/replace, update metadata (description/tags) without rewriting content, and apply changes atomically—all edits succeed or none do.
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
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | memory name (kebab-case, as memory_read takes it) | |
| edits | No | ordered 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. | |
| project | No | project slug; defaults to the bound/ambient session's project, then global. Pass project=global to target a global memory. | |
| tags_add | No | tags to add, leaving the rest in place (a comma-separated string is also accepted) | |
| description | No | replace the one-line description (<=150 chars -- the only text shown in indexes); omit to leave it untouched | |
| expect_hash | No | optional 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_remove | No | tags to remove, leaving the rest in place; this is how a tag gets cleared (a comma-separated string is also accepted) |