2.7 KiB
2.7 KiB
memory_edit
Update, forget, or invalidate Mnemopi long-term memories by id.
Source
- Entry:
packages/coding-agent/src/tools/memory-edit.ts - Model-facing prompt:
packages/coding-agent/src/prompts/tools/memory-edit.md - Backend collaborator:
packages/coding-agent/src/mnemopi/state.ts(editScopedMemory(...))
Inputs
| Field | Type | Required | Description |
|---|---|---|---|
op |
"update" | "forget" | "invalidate" |
Yes | Edit operation to apply. |
id |
string |
Yes | Memory id returned by recall. |
content |
string |
No | Replacement memory text for update. |
importance |
number |
No | Replacement importance for update; clamped to 0..1. |
replacement_id |
string |
No | Superseding memory id recorded for invalidate. |
Outputs
content[0].type = "text"content[0].text = "Memory <id> <status> in bank <bank> (<store>)."or"Memory <id> was not found..."detailsis the backend edit result fromeditScopedMemory(...), including status and location metadata when available.
Flow
MemoryEditTool.createIf(...)exposes the tool only whenmemory.backend == "mnemopi".execute(...)fetchessession.getMnemopiSessionState()and fails if the backend is not initialized.updaterequires at least one ofcontentorimportance.importanceis clamped to0..1before the backend call.- The tool calls
state.editScopedMemory(op, id, { content, importance, replacementId }). - The backend status is rendered into a short text result and returned unchanged in
details.
Modes / Variants
updatereplaces memory text and/or importance in the scoped Mnemopi store.forgetpermanently deletes the addressed memory.invalidatesoftly supersedes a memory and may point atreplacement_id.
Side Effects
- Filesystem: mutates the local Mnemopi SQLite database for the active scoped bank.
- Network: none from the tool itself.
- Session state: reads the active session's Mnemopi state.
Limits & Caps
- Availability requires
memory.backend = "mnemopi"; Hindsight and local memory backends do not expose this tool. idmust come fromrecall; the tool does not search by content.updatewith neithercontentnorimportanceis rejected before any backend write.
Errors
Mnemopi backend is not initialised for this session.when the tool is exposed but session state is missing.memory_edit update requires content or importance.for an empty update.- Missing ids are normal results, not thrown errors; the text says the memory was not found.
Notes
- Prefer
invalidatefor stale facts whose history may remain useful. - Use
forgetonly when content should be hard-deleted.