You’ll use this when…
- Stored memories need to stay consistent as users change preferences or correct past statements.
- Your product has clear rules for when to add, update, delete, or leave a memory untouched.
- You want traceable decisions (ADD, UPDATE, DELETE, NONE) for auditing or compliance.
Feature anatomy
- Action verbs: The prompt teaches the model to return
ADD,UPDATE,DELETE, orNONEfor every memory entry. - ID retention: Updates reuse the original memory ID so downstream systems maintain history.
- Old vs. new text: Updates include
old_memoryso you can track what changed. - Decision table: Your prompt should explain when to use each action and show concrete examples.
Decision guide
Decision guide
| Action | When to choose it | Output details |
|---|---|---|
ADD | Fact is new and not stored yet | Generate a new ID and set event: "ADD". |
UPDATE | Fact replaces older info about the same topic | Keep the original ID, include old_memory. |
DELETE | Fact contradicts the stored memory or you explicitly remove it | Keep ID, set event: "DELETE". |
NONE | Fact matches existing memory or is irrelevant | Keep ID with event: "NONE". |
Configure it
Author the prompt
Define the expected output format
Consistent JSON structure makes it easy to parse decisions downstream or log them for auditing.
See it in action
- Run reconciliation jobs that compare retrieved facts to existing memories.
- Feed both sources into the custom prompt, then apply the returned actions (add new entries, update text, delete outdated facts).
- Log each decision so product teams can review why a change happened.
The prompt works alongside
custom_fact_extraction_prompt—fact extraction identifies candidate facts, and the update prompt decides how to merge them into long-term storage.Verify the feature is working
- Test all four actions with targeted examples, including edge cases where facts differ only slightly.
- Confirm update responses keep the original IDs and include
old_memory. - Ensure delete actions only trigger when contradictions appear or when you explicitly request removal.
Best practices
- Keep instructions brief: Remove redundant wording so the LLM focuses on the decision logic.
- Document your schema: Share the prompt and examples with your team so everyone knows how memories evolve.
- Track prompt versions: When rules change, bump a version number and archive the prior prompt.
- Review outputs regularly: Skim audit logs weekly to spot drift or repeated mistakes.
- Pair with monitoring: Visualize counts of each action to detect spikes in deletes or updates.
Compare prompts
| Feature | custom_update_memory_prompt | custom_fact_extraction_prompt |
|---|---|---|
| Primary job | Decide memory actions (ADD/UPDATE/DELETE/NONE) | Pull facts from user and assistant messages |
| Inputs | Retrieved facts + existing memory entries | Raw conversation turns |
| Output | Structured memory array with events | Array of extracted facts |