Parameters
namestringrequiredThe note's name as stored — the converted form, the one list() shows.
Returns
await api.memory.delete("tone-of-voice");
// { ok: true, deleted: true }
await api.memory.delete("never-existed");
// { ok: true, deleted: false } ← no errorapi.memory.delete("tone-of-voice")
# {"ok": True, "deleted": True}
api.memory.delete("never-existed")
# {"ok": True, "deleted": False} ← no errorThe call succeeds either way. Read deleted when you need to know whether anything was there — a cleanup job can ignore it, a confirmation message should not.
const { deleted } = await api.memory.delete(name);
ui.toast(deleted ? `Forgot "${name}".` : `There was nothing called "${name}".`);deleted = api.memory.delete(name)["deleted"]
ui.toast(f'Forgot "{name}".' if deleted else f'There was nothing called "{name}".')Use the stored name
Names are converted when saved, so the name you passed to save() may not be the name the note has. Delete with what list() shows, or the call succeeds and removes nothing.
await api.memory.save({ name: "Tone Of Voice", content: "…" });
await api.memory.delete("Tone Of Voice"); // { deleted: false } — stored as "tone-of-voice"
const notes = await api.memory.list();
const match = notes.find((n) => n.description.includes("written to"));
if (match) await api.memory.delete(match.name); // this worksapi.memory.save(name="Tone Of Voice", content="…")
api.memory.delete("Tone Of Voice") # {"deleted": False} — stored as "tone-of-voice"
notes = api.memory.list()
match = next((n for n in notes if "written to" in n["description"]), None)
if match:
api.memory.delete(match["name"]) # this worksIt is gone
No trash, no versions. A note is a few lines of text, and keeping copies of forgotten things would defeat the point of being able to forget them.
// Keep a copy yourself if you want one
const note = (await api.memory.list()).find((n) => n.name === name);
if (note) await audit.record({ action: "memory.delete", note, by: userId });
await api.memory.delete(name);# Keep a copy yourself if you want one
note = next((n for n in api.memory.list() if n["name"] == name), None)
if note:
audit.record(action="memory.delete", note=note, by=user_id)
api.memory.delete(name)Whose decision this is
A note is something remembered about the account holder. Deleting one on their behalf — to free space, to tidy up, because it looked old — is a choice about them, and worth leaving to them. Showing the list and letting them pick costs one free call.
« Forget everything » is easy to implement and hard to undo. If you offer it, say exactly what will be forgotten and show the list first.