Do not save a secret
The password stays out
Memory stores are meant for helpful user preferences and context — never passwords, API keys, or sensitive credentials. Filtering out secrets before calling add_long_term keeps private data from leaking into future prompts or disk logs.
A password is not a fact to keep. This page saves the name and does not save the password.
The name prints. The password line says Not saved.
Expected output: the safe name prints from memory while the password check prints 'Not saved'.
Example
from praisonai.memory import FileMemory
memory = FileMemory(user_id="learner")
memory.add_long_term("The learner name is Nila.")
print(memory.search("name")[0]["item"]["content"])
print(memory.search("password") or "Not saved.")Example explained
- password — Never passed to add_long_term, so search finds nothing.
Enforce secret filtering in code, not just prompts
Never rely solely on asking the model not to save passwords or API keys. Put a deterministic Python check (blocking sk-, password, token, and SSN patterns) right in front of FileMemory or MemoryConfig writes.
Common pitfall: forgetting to scrub secrets before storing conversation summaries leaks credentials even when raw turns are blocked.
Reference: documentation