Refresh the owner after switching or loading
1. Use a character-choice Button to run a wrapper that switches the player and then calls memory_tools.refresh.
2. The memory_switch example switches to assistant. Make equivalent wrappers for the other recipients, or expose a recipient parameter through your function definitions.
3. When a save is loaded, refresh the active memory arrays from the restored active character. Use a global scene-loaded/player-changed hook if you want that refresh to be automatic.
4. Clear memory_topic after a character switch so that a previous character’s selected topic is not reused accidentally.
5. Check both panels after switching: STM and LTM must describe the same active owner.
The two active display arrays are convenient views, not the full record of all characters’ knowledge. Keep stm_character and ltm_character as the stored source of truth.
The sample refresh function copies the saved arrays. A later change to one character’s memory should not mutate another character’s array through a shared reference.
